linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwp.linux@gmail.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Hugh Dickins <hughd@google.com>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, Wanpeng Li <liwp.linux@gmail.com>
Subject: Re: [patch 08/11] mm: memcg: remove needless !mm fixup to init_mm when charging
Date: Tue, 10 Jul 2012 14:54:48 +0800	[thread overview]
Message-ID: <20120710065448.GB6096@kernel> (raw)
In-Reply-To: <20120710062104.GA19223@tiehlicka.suse.cz>

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@cmpxchg.org>
>> >
>> >Acked-by: Michal Hocko <mhocko@suse.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@vger.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-07-10  6:55 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  0:44 [patch 00/11] mm: memcg: charge/uncharge improvements Johannes Weiner
2012-07-05  0:44 ` [patch 01/11] mm: memcg: fix compaction/migration failing due to memcg limits Johannes Weiner
2012-07-09  2:27   ` Kamezawa Hiroyuki
2012-07-09 14:15   ` Michal Hocko
2012-07-05  0:44 ` [patch 02/11] mm: swapfile: clean up unuse_pte race handling Johannes Weiner
2012-07-09  2:29   ` Kamezawa Hiroyuki
2012-07-09 14:22   ` Michal Hocko
2012-07-05  0:44 ` [patch 03/11] mm: shmem: do not try to uncharge known swapcache pages Johannes Weiner
2012-07-09  2:33   ` Kamezawa Hiroyuki
2012-07-09 14:46   ` Michal Hocko
2012-07-09 20:37     ` Hugh Dickins
2012-07-10 17:16       ` Michal Hocko
2012-07-11 18:48         ` Hugh Dickins
2012-07-12 13:51           ` Michal Hocko
2012-07-09 20:11   ` Hugh Dickins
2012-07-05  0:44 ` [patch 04/11] mm: memcg: push down PageSwapCache check into uncharge entry functions Johannes Weiner
2012-07-09  2:42   ` Kamezawa Hiroyuki
2012-07-09  7:36     ` Johannes Weiner
2012-07-09 15:02   ` Michal Hocko
2012-07-05  0:44 ` [patch 05/11] mm: memcg: only check for PageSwapCache when uncharging anon Johannes Weiner
2012-07-09  2:49   ` Kamezawa Hiroyuki
2012-07-09 15:05   ` Michal Hocko
2012-07-05  0:44 ` [patch 06/11] mm: memcg: move swapin charge functions above callsites Johannes Weiner
2012-07-09  2:50   ` Kamezawa Hiroyuki
2012-07-09 15:10   ` Michal Hocko
2012-07-05  0:44 ` [patch 07/11] mm: memcg: remove unneeded shmem charge type Johannes Weiner
2012-07-09  2:51   ` Kamezawa Hiroyuki
2012-07-09 15:17   ` Michal Hocko
2012-07-05  0:45 ` [patch 08/11] mm: memcg: remove needless !mm fixup to init_mm when charging Johannes Weiner
2012-07-09  2:53   ` Kamezawa Hiroyuki
2012-07-09 15:20   ` Michal Hocko
2012-07-10  6:10     ` Wanpeng Li
2012-07-10  6:21       ` Michal Hocko
2012-07-10  6:54         ` Wanpeng Li [this message]
2012-07-10 16:22           ` Michal Hocko
2012-07-05  0:45 ` [patch 09/11] mm: memcg: split swapin charge function into private and public part Johannes Weiner
2012-07-09  2:55   ` Kamezawa Hiroyuki
2012-07-09 15:28   ` Michal Hocko
2012-07-05  0:45 ` [patch 10/11] mm: memcg: only check swap cache pages for repeated charging Johannes Weiner
2012-07-09  3:26   ` Kamezawa Hiroyuki
2012-07-09 15:32   ` Michal Hocko
2012-07-05  0:45 ` [patch 11/11] mm: memcg: only check anon swapin page charges for swap cache Johannes Weiner
2012-07-09  3:44   ` Kamezawa Hiroyuki
2012-07-09 15:34   ` Michal Hocko
2012-07-09 15:35 ` [patch 00/11] mm: memcg: charge/uncharge improvements Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120710065448.GB6096@kernel \
    --to=liwp.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).