From owner-p4-projects@FreeBSD.ORG Fri Aug 27 17:46:18 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 293EE10656AC; Fri, 27 Aug 2010 17:46:18 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFE3E1065698 for ; Fri, 27 Aug 2010 17:46:17 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id CD4928FC13 for ; Fri, 27 Aug 2010 17:46:17 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7RHkH0Q038493 for ; Fri, 27 Aug 2010 17:46:17 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7RHkH8i038490 for perforce@freebsd.org; Fri, 27 Aug 2010 17:46:17 GMT (envelope-from trasz@freebsd.org) Date: Fri, 27 Aug 2010 17:46:17 GMT Message-Id: <201008271746.o7RHkH8i038490@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182961 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2010 17:46:18 -0000 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 #include #include +#include #include #include @@ -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