Date: Fri, 27 Aug 2010 17:46:17 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 182961 for review Message-ID: <201008271746.o7RHkH8i038490@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182961?ac=10 Change 182961 by trasz@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008271746.o7RHkH8i038490>