cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamezawa Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
	Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	David Rientjes <rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [patch 04/11] mm: memcg: push down PageSwapCache check into uncharge entry functions
Date: Mon, 09 Jul 2012 11:42:12 +0900	[thread overview]
Message-ID: <4FFA4504.4040408@jp.fujitsu.com> (raw)
In-Reply-To: <1341449103-1986-5-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>

(2012/07/05 9:44), Johannes Weiner wrote:
> Not all uncharge paths need to check if the page is swapcache, some of
> them can know for sure.
> 
> Push down the check into all callsites of uncharge_common() so that
> the patch that removes some of them is more obvious.
> 
> Signed-off-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
> ---

some nitpick.

>   mm/memcontrol.c |   18 ++++++++++++------
>   1 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 4ea19c6..a3bf414 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2920,8 +2920,7 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype,
>   	if (mem_cgroup_disabled())
>   		return NULL;
>   
> -	if (PageSwapCache(page))
> -		return NULL;
> +	VM_BUG_ON(PageSwapCache(page));
>   
>   	if (PageTransHuge(page)) {
>   		nr_pages <<= compound_order(page);
> @@ -3018,6 +3017,8 @@ void mem_cgroup_uncharge_page(struct page *page)
>   	if (page_mapped(page))
>   		return;
>   	VM_BUG_ON(page->mapping && !PageAnon(page));
> +	if (PageSwapCache(page))
> +		return;
>   	__mem_cgroup_uncharge_common(page, MEM_CGROUP_CHARGE_TYPE_ANON, false);
>   }
>   
> @@ -3025,6 +3026,8 @@ void mem_cgroup_uncharge_cache_page(struct page *page)
>   {
>   	VM_BUG_ON(page_mapped(page));
>   	VM_BUG_ON(page->mapping);
> +	if (PageSwapCache(page))
> +		return;
>   	__mem_cgroup_uncharge_common(page, MEM_CGROUP_CHARGE_TYPE_CACHE, false);
>   }
>   
> @@ -3089,6 +3092,8 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
>   	if (!swapout) /* this was a swap cache but the swap is unused ! */
>   		ctype = MEM_CGROUP_CHARGE_TYPE_DROP;
>   
> +	if (PageSwapCache(page))
> +		return;
>   	memcg = __mem_cgroup_uncharge_common(page, ctype, false);
>   
>   	/*
> @@ -3278,10 +3283,11 @@ void mem_cgroup_end_migration(struct mem_cgroup *memcg,
>   		unused = oldpage;
>   	}
>   	anon = PageAnon(used);
> -	__mem_cgroup_uncharge_common(unused,
> -		anon ? MEM_CGROUP_CHARGE_TYPE_ANON
> -		     : MEM_CGROUP_CHARGE_TYPE_CACHE,
> -		true);
> +	if (!PageSwapCache(page))
> +		__mem_cgroup_uncharge_common(unused,
> +					     anon ? MEM_CGROUP_CHARGE_TYPE_ANON
> +					     : MEM_CGROUP_CHARGE_TYPE_CACHE,
> +					     true);

!PageSwapCache(unused) ?

But I think unused page's PG_swapcache is always dropped. So, the check is
not necessary.

Thanks,
-Kame










  parent reply	other threads:[~2012-07-09  2:42 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
     [not found]   ` <1341449103-1986-2-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-3-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]       ` <alpine.LSU.2.00.1207091311300.1842-fupSdm12i1nKWymIFiNcPA@public.gmane.org>
2012-07-10 17:16         ` Michal Hocko
     [not found]           ` <20120710171628.GB29114-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-07-11 18:48             ` Hugh Dickins
2012-07-12 13:51               ` Michal Hocko
     [not found]   ` <1341449103-1986-4-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-5-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2012-07-09  2:42     ` Kamezawa Hiroyuki [this message]
     [not found]       ` <4FFA4504.4040408-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
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
     [not found]   ` <1341449103-1986-6-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-7-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-8-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-9-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2012-07-09 15:20     ` Michal Hocko
     [not found]       ` <20120709152058.GK4627-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-07-10  6:10         ` Wanpeng Li
2012-07-10  6:21           ` Michal Hocko
2012-07-10  6:54             ` Wanpeng Li
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
     [not found]   ` <1341449103-1986-10-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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
     [not found]   ` <1341449103-1986-12-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2012-07-09  3:44     ` Kamezawa Hiroyuki
2012-07-09 15:34     ` Michal Hocko
     [not found] ` <1341449103-1986-1-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
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=4FFA4504.4040408@jp.fujitsu.com \
    --to=kamezawa.hiroyu-+cum20s59erqfuhtdcdx3a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
    --cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    /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).