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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120314162129.GA1709@cmpxchg.org>
Date:	Wed, 14 Mar 2012 17:21:29 +0100
From:	Johannes Weiner <hannes@...xchg.org>
To:	Michal Hocko <mhocko@...e.cz>
Cc:	Konstantin Khlebnikov <khlebnikov@...nvz.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 2/2] mm: memcg: count pte references from every member of
 the reclaimed hierarchy

On Wed, Mar 14, 2012 at 03:25:19PM +0100, Michal Hocko wrote:
> On Tue 28-02-12 15:14:49, Johannes Weiner wrote:
> [...]
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index b4622fb..21004df 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -1044,17 +1044,23 @@ struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
> >   * Checks whether given mem is same or in the root_mem_cgroup's
> >   * hierarchy subtree
> >   */
> > -static bool mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
> > -		struct mem_cgroup *memcg)
> > +bool __mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
> > +				  struct mem_cgroup *memcg)
> >  {
> > -	bool ret;
> > -
> >  	if (root_memcg == memcg)
> >  		return true;
> >  	if (!root_memcg->use_hierarchy)
> >  		return false;
> > +	return css_is_ancestor(&memcg->css, &root_memcg->css);
> > +}
> > +
> > +static bool mem_cgroup_same_or_subtree(const struct mem_cgroup *root_memcg,
> > +				       struct mem_cgroup *memcg)
> > +{
> > +	bool ret;
> > +
> >  	rcu_read_lock();
> > -	ret = css_is_ancestor(&memcg->css, &root_memcg->css);
> > +	ret = __mem_cgroup_same_or_subtree(root_memcg, memcg);
> >  	rcu_read_unlock();
> >  	return ret;
> >  }
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index c631234..120646e 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -708,7 +708,8 @@ static enum page_references page_check_references(struct page *page,
> >  	int referenced_ptes, referenced_page;
> >  	unsigned long vm_flags;
> >  
> > -	referenced_ptes = page_referenced(page, 1, mz->mem_cgroup, &vm_flags);
> > +	referenced_ptes = page_referenced(page, 1, sc->target_mem_cgroup,
> > +					  &vm_flags);
> >  	referenced_page = TestClearPageReferenced(page);
> 
> Maybe a stupid question but isn't target_mem_cgroup NULL in the global
> reclaim case? And we doesn't handle that in __mem_cgroup_same_or_subtree...

It's intentional, page_referenced() does not call into same_or_subtree
if the group is NULL.  As a result, no references are filtered, they
all matter in the global reclaim case.
--
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