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]
Date:	Tue, 10 Jul 2012 14:54:48 +0800
From:	Wanpeng Li <liwp.linux@...il.com>
To:	Michal Hocko <mhocko@...e.cz>
Cc:	Johannes Weiner <hannes@...xchg.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Hugh Dickins <hughd@...gle.com>,
	David Rientjes <rientjes@...gle.com>, linux-mm@...ck.org,
	cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
	Wanpeng Li <liwp.linux@...il.com>
Subject: Re: [patch 08/11] mm: memcg: remove needless !mm fixup to init_mm
 when charging

On Tue, Jul 10, 2012 at 08:21:04AM +0200, Michal Hocko wrote:
>On Tue 10-07-12 14:10:21, Wanpeng Li wrote:
>> On Mon, Jul 09, 2012 at 05:20:58PM +0200, Michal Hocko wrote:
>> >On Thu 05-07-12 02:45:00, Johannes Weiner wrote:
>> >> It does not matter to __mem_cgroup_try_charge() if the passed mm is
>> >> NULL or init_mm, it will charge the root memcg in either case.
>> 
>> You can also change the comment in __mem_cgroup_try_charge :
>> 
>> "if so charge the init_mm" => "if so charge the root memcg"
>
>This is already in place:
>"
>If mm is NULL and the caller doesn't pass a valid memcg pointer, that is
>treated as a charge to root_mem_cgroup.
>"

IIUC, if still keep comment "if so charge the init_mm" is not correct,
since pages in pagecache aren't mapped into any processes' ptes, 
so mm is NULL, and these pages which in pagecache are not belong 
to init_mm, the comment should be changed. :-)

>> 
>> >> 
>> >> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
>> >
>> >Acked-by: Michal Hocko <mhocko@...e.cz>
>> >
>> >> ---
>> >>  mm/memcontrol.c |    5 -----
>> >>  1 files changed, 0 insertions(+), 5 deletions(-)
>> >> 
>> >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> >> index 418b47d..6fe4101 100644
>> >> --- a/mm/memcontrol.c
>> >> +++ b/mm/memcontrol.c
>> >> @@ -2766,8 +2766,6 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
>> >>  		ret = 0;
>> >>  	return ret;
>> >>  charge_cur_mm:
>> >> -	if (unlikely(!mm))
>> >> -		mm = &init_mm;
>> >>  	ret = __mem_cgroup_try_charge(mm, mask, 1, memcgp, true);
>> >>  	if (ret == -EINTR)
>> >>  		ret = 0;
>> >> @@ -2832,9 +2830,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
>> >>  	if (PageCompound(page))
>> >>  		return 0;
>> >>  
>> >> -	if (unlikely(!mm))
>> >> -		mm = &init_mm;
>> >> -
>> >>  	if (!PageSwapCache(page))
>> >>  		ret = mem_cgroup_charge_common(page, mm, gfp_mask, type);
>> >>  	else { /* page is swapcache/shmem */
>> >> -- 
>> >> 1.7.7.6
>> >> 
>> >
>> >-- 
>> >Michal Hocko
>> >SUSE Labs
>> >SUSE LINUX s.r.o.
>> >Lihovarska 1060/12
>> >190 00 Praha 9    
>> >Czech Republic
>> >--
>> >To unsubscribe from this list: send the line "unsubscribe cgroups" in
>> >the body of a message to majordomo@...r.kernel.org
>> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>-- 
>Michal Hocko
>SUSE Labs
>SUSE LINUX s.r.o.
>Lihovarska 1060/12
>190 00 Praha 9    
>Czech Republic
--
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