From owner-p4-projects@FreeBSD.ORG Sun Jan 16 18:04:28 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E04A10656C6; Sun, 16 Jan 2011 18:04:28 +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 0845E10656C1 for ; Sun, 16 Jan 2011 18:04:28 +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 E02AB8FC0A for ; Sun, 16 Jan 2011 18:04:27 +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 p0GI4RfV091593 for ; Sun, 16 Jan 2011 18:04:27 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p0GI4RRp091590 for perforce@freebsd.org; Sun, 16 Jan 2011 18:04:27 GMT (envelope-from trasz@freebsd.org) Date: Sun, 16 Jan 2011 18:04:27 GMT Message-Id: <201101161804.p0GI4RRp091590@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 187865 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: Sun, 16 Jan 2011 18:04:28 -0000 http://p4web.freebsd.org/@@187865?ac=10 Change 187865 by trasz@trasz_victim on 2011/01/16 18:03:31 Make routine names less confusing. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#55 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#11 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/rctl.h#5 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#55 (text+ko) ==== @@ -311,7 +311,7 @@ mtx_lock(&container_lock); #ifdef RCTL - error = rctl_enforce_proc(p, resource, amount); + error = rctl_enforce(p, resource, amount); if (error && container_resource_deniable(resource)) { SDT_PROBE(container, kernel, rusage, add_failure, p, resource, amount, 0, 0); mtx_unlock(&container_lock); @@ -402,7 +402,7 @@ #endif #ifdef RCTL if (diff > 0) { - error = rctl_enforce_proc(p, resource, diff); + error = rctl_enforce(p, resource, diff); if (error && container_resource_deniable(resource)) { SDT_PROBE(container, kernel, rusage, set_failure, p, resource, amount, 0, 0); return (error); @@ -462,14 +462,15 @@ /* * Returns amount of 'resource' the process 'p' can keep allocated. * Allocating more than that would be denied, unless the resource - * is marked undeniable. + * is marked undeniable. Amount of already allocated resource does + * not matter. */ uint64_t rusage_get_limit(struct proc *p, int resource) { #ifdef RCTL - return (rctl_available_proc(p, resource)); + return (rctl_get_limit(p, resource)); #else return (UINT64_MAX); #endif ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#11 (text+ko) ==== @@ -279,7 +279,7 @@ * be denied, 0 otherwise. */ int -rctl_enforce_proc(struct proc *p, int resource, uint64_t amount) +rctl_enforce(struct proc *p, int resource, uint64_t amount) { struct rctl_rule *rule; struct rctl_rule_link *link; @@ -312,7 +312,7 @@ buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); if (buf == NULL) { - printf("rctl_enforce_proc: out of memory\n"); + printf("rctl_enforce: out of memory\n"); continue; } sbuf_new(&sb, buf, RCTL_LOG_BUFSIZE, SBUF_FIXEDLEN); @@ -343,7 +343,7 @@ rctl_deferred_psignal(p, SIGXFSZ); continue; default: - panic("rctl_enforce_proc: unknown action %d", + panic("rctl_enforce: unknown action %d", rule->rr_action); } } @@ -362,7 +362,7 @@ } uint64_t -rctl_available_proc(struct proc *p, int resource) +rctl_get_limit(struct proc *p, int resource) { struct rctl_rule *rule; struct rctl_rule_link *link; ==== //depot/projects/soc2009/trasz_limits/sys/sys/rctl.h#5 (text+ko) ==== @@ -119,8 +119,8 @@ int rctl_rule_add(struct rctl_rule *rule); int rctl_rule_remove(struct rctl_rule *filter); -int rctl_enforce_proc(struct proc *p, int resource, uint64_t amount); -uint64_t rctl_available_proc(struct proc *p, int resource); +int rctl_enforce(struct proc *p, int resource, uint64_t amount); +uint64_t rctl_get_limit(struct proc *p, int resource); const char *rctl_resource_name(int resource); int rctl_proc_fork(struct proc *parent, struct proc *child); void rctl_proc_exit(struct proc *p);