lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090312125839.3b01e20c.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Thu, 12 Mar 2009 12:58:39 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	balbir@...ux.vnet.ibm.com
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"kosaki.motohiro@...fujitsu.com" <kosaki.motohiro@...fujitsu.com>
Subject: Re: [RFC][PATCH 2/5] add softlimit to res_counter

On Thu, 12 Mar 2009 09:24:44 +0530
Balbir Singh <balbir@...ux.vnet.ibm.com> wrote:

>
> > +int res_counter_set_softlimit(struct res_counter *cnt, unsigned long long val)
> > +{
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&cnt->lock, flags);
> > +	cnt->softlimit = val;
> > +	spin_unlock_irqrestore(&cnt->lock, flags);
> > +	return 0;
> > +}
> > +
> > +bool res_counter_check_under_softlimit(struct res_counter *cnt)
> > +{
> > +	struct res_counter *c;
> > +	unsigned long flags;
> > +	bool ret = true;
> > +
> > +	local_irq_save(flags);
> > +	for (c = cnt; ret && c != NULL; c = c->parent) {
> > +		spin_lock(&c->lock);
> > +		if (c->softlimit < c->usage)
> > +			ret = false;
> 
> So if a child was under the soft limit and the parent is *not*, we
> _override_ ret and return false?
> 
yes. If you don't want this behavior I'll rename this to
res_counter_check_under_softlimit_hierarchical().


> > +		spin_unlock(&c->lock);
> > +	}
> > +	local_irq_restore(flags);
> > +	return ret;
> > +}
> 
> Why is the check_under_softlimit hierarchical? 

At checking whether a mem_cgroup is a candidate for softlimit-reclaim,
we need to check all parents.

> BTW, this patch is buggy. See above.
> 

Not buggy. Just meets my requiremnt.


Thanks,
-Kame

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ