From owner-p4-projects@FreeBSD.ORG Sat Aug 7 12:49:22 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7B53E1065679; Sat, 7 Aug 2010 12:49:22 +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 3FF741065672 for ; Sat, 7 Aug 2010 12:49:22 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 135828FC16 for ; Sat, 7 Aug 2010 12:49:22 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o77CnLMj092053 for ; Sat, 7 Aug 2010 12:49:21 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o77CnLNf092051 for perforce@freebsd.org; Sat, 7 Aug 2010 12:49:21 GMT (envelope-from trasz@freebsd.org) Date: Sat, 7 Aug 2010 12:49:21 GMT Message-Id: <201008071249.o77CnLNf092051@repoman.freebsd.org> X-Authentication-Warning: repoman.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 182022 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: Sat, 07 Aug 2010 12:49:22 -0000 http://p4web.freebsd.org/@@182022?ac=10 Change 182022 by trasz@trasz_victim on 2010/08/07 12:49:01 Turn destroying a non-empty container (container for which any counter for reclaimable resource is > 0) into an error. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#25 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#25 (text+ko) ==== @@ -236,22 +236,6 @@ mtx_unlock(&container_lock); } -static void -container_leave_parents(struct container *child) -{ - int i; - - mtx_assert(&container_lock, MA_OWNED); - KASSERT(child != NULL, ("child != NULL")); - - for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { - if (child->c_parents[i] == NULL) - continue; - container_sub(child->c_parents[i], child); - child->c_parents[i] = NULL; - } -} - void container_create(struct container *container) { @@ -278,15 +262,15 @@ KASSERT(container != NULL, ("NULL container")); for (i = 0; i <= RUSAGE_MAX; i++) { - if (container->c_resources[i] != 0 && - container_resource_reclaimable(i)) - printf("destroying non-empty container: " - "%ju allocated for resource %d", - container->c_resources[i], i); - container->c_resources[i] = 0; + KASSERT(container->c_resources[i] == 0 || + !container_resource_reclaimable(i), + ("destroying non-empty container: " + "%ju allocated for resource %d\n", + container->c_resources[i], i)); } - container_leave_parents(container); + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) + container->c_parents[i] = NULL; } void @@ -564,6 +548,7 @@ * XXX: Free this some other way. */ rusage_set(p, RUSAGE_FSIZE, 0); + rusage_set(p, RUSAGE_NPTS, 0); #ifdef HRL hrl_proc_exit(p);