Date: Mon, 12 Jul 2010 18:26:28 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 180840 for review Message-ID: <201007121826.o6CIQS59080924@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180840?ac=10 Change 180840 by trasz@trasz_victim on 2010/07/12 18:26:00 Remove unfinished optimisation that had no chance of working. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#85 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#85 (text+ko) ==== @@ -126,7 +126,6 @@ static struct mtx hrl_lock; MTX_SYSINIT(hrl_lock, &hrl_lock, "HRL lock", MTX_DEF); -static void hrl_compute_available(struct proc *p, int64_t (*availablep)[]); static int hrl_rule_fully_specified(const struct hrl_rule *rule); static void hrl_rule_to_sbuf(struct sbuf *sb, const struct hrl_rule *rule); @@ -267,7 +266,6 @@ int hrl_enforce_proc(struct proc *p, int resource, uint64_t amount) { - int64_t available[RUSAGE_MAX]; struct hrl_rule *rule; struct hrl_rule_link *link; struct sbuf sb; @@ -277,16 +275,6 @@ mtx_lock(&hrl_lock); /* - * XXX: Do this just before we start running on a CPU, not all the time. - */ - hrl_compute_available(p, &available); - - if (available[resource] >= amount) { - mtx_unlock(&hrl_lock); - return (0); - } - - /* * It seems we've hit a limit. Figure out what to do. There may * be more than one matching limit; go through all of them. Denial * should be done last, after logging and sending signals. @@ -363,39 +351,6 @@ return (0); } -/* - * Go through all the rules applicable to the process, filling the array - * with amount of resource left before hitting the next limit. - */ -static void -hrl_compute_available(struct proc *p, int64_t (*availablep)[]) -{ - int i, resource; - int64_t available; - struct hrl_rule_link *link; - struct hrl_rule *rule; - - mtx_assert(&hrl_lock, MA_OWNED); - - for (i = 0; i <= RUSAGE_MAX; i++) - (*availablep)[i] = INT64_MAX; - - LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { - rule = link->hrl_rule; - resource = rule->hr_resource; - available = hrl_available_resource(p, rule); - if (available < 0) { -#ifdef notyet - KASSERT(rule->hr_action != HRL_ACTION_DENY, - ("hrl_compute_available: deny rule already exceeded")); -#endif - continue; - } - if (available < (*availablep)[resource]) - (*availablep)[resource] = available; - } -} - static int hrl_rule_matches(const struct hrl_rule *rule, const struct hrl_rule *filter) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007121826.o6CIQS59080924>