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: <20090116103810.5ef55cc3.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Fri, 16 Jan 2009 10:38:10 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"menage@...gle.com" <menage@...gle.com>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>
Subject: Re: [PATCH 3/4] memcg: hierarchical reclaim by CSS ID

On Fri, 16 Jan 2009 09:29:48 +0800
Li Zefan <lizf@...fujitsu.com> wrote:

> >  /*
> > - * Dance down the hierarchy if needed to reclaim memory. We remember the
> > - * last child we reclaimed from, so that we don't end up penalizing
> > - * one child extensively based on its position in the children list.
> > + * Visit the first child (need not be the first child as per the ordering
> > + * of the cgroup list, since we track last_scanned_child) of @mem and use
> > + * that to reclaim free pages from.
> > + */
> > +static struct mem_cgroup *
> > +mem_cgroup_select_victim(struct mem_cgroup *root_mem)
> > +{
> > +	struct mem_cgroup *ret = NULL;
> > +	struct cgroup_subsys_state *css;
> > +	int nextid, found;
> > +
> > +	if (!root_mem->use_hierarchy) {
> > +		spin_lock(&root_mem->reclaim_param_lock);
> > +		root_mem->scan_age++;
> > +		spin_unlock(&root_mem->reclaim_param_lock);
> > +		css_get(&root_mem->css);
> > +		ret = root_mem;
> > +	}
> > +
> > +	while (!ret) {
> > +		rcu_read_lock();
> > +		nextid = root_mem->last_scanned_child + 1;
> > +		css = css_get_next(&mem_cgroup_subsys, nextid, &root_mem->css,
> > +				   &found);
> > +		if (css && css_is_populated(css) && css_tryget(css))
> 
> I don't see why you need to check css_is_populated(css) ?
> 

Main reason is for sanity. I don't like to hold css->refcnt of not populated css.
Second reason is for avoinding unnecessary calls to try_to_free_pages(),
it's heavy. I should also add mem->res.usage == 0 case for skipping but not yet.

THanks,
-Kame

> > +			ret = container_of(css, struct mem_cgroup, css);
> > +
> > +		rcu_read_unlock();
> > +		/* Updates scanning parameter */
> > +		spin_lock(&root_mem->reclaim_param_lock);
> > +		if (!css) {
> > +			/* this means start scan from ID:1 */
> > +			root_mem->last_scanned_child = 0;
> > +			root_mem->scan_age++;
> > +		} else
> > +			root_mem->last_scanned_child = found;
> > +		spin_unlock(&root_mem->reclaim_param_lock);
> > +	}
> > +
> > +	return ret;
> > +}
> > +
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
> 

--
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