PERFORCE change 182961 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Aug 27 17:46:18 UTC 2010
http://p4web.freebsd.org/@@182961?ac=10
Change 182961 by trasz at trasz_victim on 2010/08/27 17:45:13
The routine that updates process times takes allproc_lock sx, and it's
not legal to do this from the callout. Run it from taskqueue instead.
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#46 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#46 (text+ko) ====
@@ -59,6 +59,7 @@
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
+#include <sys/taskqueue.h>
#include <sys/time.h>
#include <sys/umtx.h>
@@ -82,7 +83,8 @@
static void ruxagg_locked(struct rusage_ext *rux, struct thread *td);
#ifdef CONTAINERS
-struct callout rusage_cpu_callout;
+static struct callout rusage_cpu_callout;
+static struct task rusage_cpu_task;
#endif
/*
@@ -624,6 +626,17 @@
static void
rusage_cpu_update(void *arg)
{
+
+ /*
+ * The rusage_cpu_task_fn() routine may sleep, so we have to put it
+ * into taskqueue instead of running directly from callout.
+ */
+ taskqueue_enqueue(taskqueue_thread, &rusage_cpu_task);
+}
+
+static void
+rusage_cpu_task_fn(void *arg, int pending)
+{
struct thread *td;
struct proc *p;
@@ -1332,6 +1345,7 @@
* XXX: Piggybacked for now; in the future it should have
* it's own function.
*/
+ TASK_INIT(&rusage_cpu_task, 0, rusage_cpu_task_fn, NULL);
callout_init(&rusage_cpu_callout, 1);
callout_reset(&rusage_cpu_callout, hz, rusage_cpu_update, NULL);
#endif
More information about the p4-projects
mailing list