All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 03/11] mm: shmem: do not try to uncharge known swapcache pages
Date: Mon, 9 Jul 2012 13:11:16 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1207091256540.1842@eggly.anvils> (raw)
In-Reply-To: <1341449103-1986-4-git-send-email-hannes@cmpxchg.org>

On Thu, 5 Jul 2012, Johannes Weiner wrote:
> Once charged, swapcache pages can only be uncharged after they are
> removed from swapcache again.
> 
> Do not try to uncharge pages that are known to be in the swapcache, to
> allow future patches to remove checks for that in the uncharge code.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/shmem.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ee1c5a2..d12b705 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -302,8 +302,6 @@ static int shmem_add_to_page_cache(struct page *page,
>  		if (!expected)
>  			radix_tree_preload_end();
>  	}
> -	if (error)
> -		mem_cgroup_uncharge_cache_page(page);
>  	return error;
>  }
>  
> @@ -1184,11 +1182,14 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		__set_page_locked(page);
>  		error = mem_cgroup_cache_charge(page, current->mm,
>  						gfp & GFP_RECLAIM_MASK);
> -		if (!error)
> -			error = shmem_add_to_page_cache(page, mapping, index,
> -						gfp, NULL);
>  		if (error)
>  			goto decused;
> +		error = shmem_add_to_page_cache(page, mapping, index,
> +						gfp, NULL);
> +		if (error) {
> +			mem_cgroup_uncharge_cache_page(page);
> +			goto decused;
> +		}
>  		lru_cache_add_anon(page);
>  
>  		spin_lock(&info->lock);
> -- 

I wanted to try this series out on mmotm before replying, and that
took a while; but the problems (some experimental RCU stuff, since
reverted; and Michal's wait_on_page_writeback in vmscan.c, I'll have
to investigate that later) were in mmotm rather than your series:
seems to be running fine under load now.

I've not reviewed, but definitely approve avoiding the temporary
extra charge in migration, and your other simplifications.

And I do approve this change, but selfishly withhold my Ack because
it's a subset of small shmem.c changes I was already lining up to
post, hoping still to sneak into 3.5.  We have a real bug in there
(charging to wrong memcg), and this cleanup comes along with that.
I'll post my version in an hour or two.

Hugh

WARNING: multiple messages have this Message-ID (diff)
From: Hugh Dickins <hughd@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 03/11] mm: shmem: do not try to uncharge known swapcache pages
Date: Mon, 9 Jul 2012 13:11:16 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1207091256540.1842@eggly.anvils> (raw)
In-Reply-To: <1341449103-1986-4-git-send-email-hannes@cmpxchg.org>

On Thu, 5 Jul 2012, Johannes Weiner wrote:
> Once charged, swapcache pages can only be uncharged after they are
> removed from swapcache again.
> 
> Do not try to uncharge pages that are known to be in the swapcache, to
> allow future patches to remove checks for that in the uncharge code.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/shmem.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ee1c5a2..d12b705 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -302,8 +302,6 @@ static int shmem_add_to_page_cache(struct page *page,
>  		if (!expected)
>  			radix_tree_preload_end();
>  	}
> -	if (error)
> -		mem_cgroup_uncharge_cache_page(page);
>  	return error;
>  }
>  
> @@ -1184,11 +1182,14 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		__set_page_locked(page);
>  		error = mem_cgroup_cache_charge(page, current->mm,
>  						gfp & GFP_RECLAIM_MASK);
> -		if (!error)
> -			error = shmem_add_to_page_cache(page, mapping, index,
> -						gfp, NULL);
>  		if (error)
>  			goto decused;
> +		error = shmem_add_to_page_cache(page, mapping, index,
> +						gfp, NULL);
> +		if (error) {
> +			mem_cgroup_uncharge_cache_page(page);
> +			goto decused;
> +		}
>  		lru_cache_add_anon(page);
>  
>  		spin_lock(&info->lock);
> -- 

I wanted to try this series out on mmotm before replying, and that
took a while; but the problems (some experimental RCU stuff, since
reverted; and Michal's wait_on_page_writeback in vmscan.c, I'll have
to investigate that later) were in mmotm rather than your series:
seems to be running fine under load now.

I've not reviewed, but definitely approve avoiding the temporary
extra charge in migration, and your other simplifications.

And I do approve this change, but selfishly withhold my Ack because
it's a subset of small shmem.c changes I was already lining up to
post, hoping still to sneak into 3.5.  We have a real bug in there
(charging to wrong memcg), and this cleanup comes along with that.
I'll post my version in an hour or two.

Hugh

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

WARNING: multiple messages have this Message-ID (diff)
From: Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	KAMEZAWA Hiroyuki
	<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>,
	Michal Hocko <mhocko-AlSwsSmVLrQ@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 03/11] mm: shmem: do not try to uncharge known swapcache pages
Date: Mon, 9 Jul 2012 13:11:16 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1207091256540.1842@eggly.anvils> (raw)
In-Reply-To: <1341449103-1986-4-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>

On Thu, 5 Jul 2012, Johannes Weiner wrote:
> Once charged, swapcache pages can only be uncharged after they are
> removed from swapcache again.
> 
> Do not try to uncharge pages that are known to be in the swapcache, to
> allow future patches to remove checks for that in the uncharge code.
> 
> Signed-off-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
> ---
>  mm/shmem.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ee1c5a2..d12b705 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -302,8 +302,6 @@ static int shmem_add_to_page_cache(struct page *page,
>  		if (!expected)
>  			radix_tree_preload_end();
>  	}
> -	if (error)
> -		mem_cgroup_uncharge_cache_page(page);
>  	return error;
>  }
>  
> @@ -1184,11 +1182,14 @@ static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
>  		__set_page_locked(page);
>  		error = mem_cgroup_cache_charge(page, current->mm,
>  						gfp & GFP_RECLAIM_MASK);
> -		if (!error)
> -			error = shmem_add_to_page_cache(page, mapping, index,
> -						gfp, NULL);
>  		if (error)
>  			goto decused;
> +		error = shmem_add_to_page_cache(page, mapping, index,
> +						gfp, NULL);
> +		if (error) {
> +			mem_cgroup_uncharge_cache_page(page);
> +			goto decused;
> +		}
>  		lru_cache_add_anon(page);
>  
>  		spin_lock(&info->lock);
> -- 

I wanted to try this series out on mmotm before replying, and that
took a while; but the problems (some experimental RCU stuff, since
reverted; and Michal's wait_on_page_writeback in vmscan.c, I'll have
to investigate that later) were in mmotm rather than your series:
seems to be running fine under load now.

I've not reviewed, but definitely approve avoiding the temporary
extra charge in migration, and your other simplifications.

And I do approve this change, but selfishly withhold my Ack because
it's a subset of small shmem.c changes I was already lining up to
post, hoping still to sneak into 3.5.  We have a real bug in there
(charging to wrong memcg), and this cleanup comes along with that.
I'll post my version in an hour or two.

Hugh

  parent reply	other threads:[~2012-07-09 20:11 UTC|newest]

Thread overview: 112+ 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 ` Johannes Weiner
2012-07-05  0:44 ` Johannes Weiner
2012-07-05  0:44 ` [patch 01/11] mm: memcg: fix compaction/migration failing due to memcg limits Johannes Weiner
2012-07-05  0:44   ` Johannes Weiner
2012-07-09  2:27   ` Kamezawa Hiroyuki
2012-07-09  2:27     ` Kamezawa Hiroyuki
2012-07-09  2:27     ` Kamezawa Hiroyuki
2012-07-09 14:15   ` Michal Hocko
2012-07-09 14:15     ` Michal Hocko
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-05  0:44   ` Johannes Weiner
2012-07-09  2:29   ` Kamezawa Hiroyuki
2012-07-09  2:29     ` Kamezawa Hiroyuki
2012-07-09 14:22   ` Michal Hocko
2012-07-09 14:22     ` Michal Hocko
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-05  0:44   ` Johannes Weiner
2012-07-09  2:33   ` Kamezawa Hiroyuki
2012-07-09  2:33     ` Kamezawa Hiroyuki
2012-07-09 14:46   ` Michal Hocko
2012-07-09 14:46     ` Michal Hocko
2012-07-09 20:37     ` Hugh Dickins
2012-07-09 20:37       ` Hugh Dickins
2012-07-10 17:16       ` Michal Hocko
2012-07-10 17:16         ` Michal Hocko
2012-07-10 17:16         ` Michal Hocko
2012-07-11 18:48         ` Hugh Dickins
2012-07-11 18:48           ` Hugh Dickins
2012-07-11 18:48           ` Hugh Dickins
2012-07-12 13:51           ` Michal Hocko
2012-07-12 13:51             ` Michal Hocko
2012-07-09 20:11   ` Hugh Dickins [this message]
2012-07-09 20:11     ` Hugh Dickins
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-05  0:44   ` Johannes Weiner
2012-07-09  2:42   ` Kamezawa Hiroyuki
2012-07-09  2:42     ` Kamezawa Hiroyuki
2012-07-09  2:42     ` Kamezawa Hiroyuki
2012-07-09  7:36     ` Johannes Weiner
2012-07-09  7:36       ` Johannes Weiner
2012-07-09  7:36       ` Johannes Weiner
2012-07-09 15:02   ` Michal Hocko
2012-07-09 15:02     ` Michal Hocko
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-05  0:44   ` Johannes Weiner
2012-07-09  2:49   ` Kamezawa Hiroyuki
2012-07-09  2:49     ` Kamezawa Hiroyuki
2012-07-09  2:49     ` Kamezawa Hiroyuki
2012-07-09 15:05   ` Michal Hocko
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-05  0:44   ` Johannes Weiner
2012-07-09  2:50   ` Kamezawa Hiroyuki
2012-07-09  2:50     ` Kamezawa Hiroyuki
2012-07-09  2:50     ` Kamezawa Hiroyuki
2012-07-09 15:10   ` Michal Hocko
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-05  0:44   ` Johannes Weiner
2012-07-09  2:51   ` Kamezawa Hiroyuki
2012-07-09  2:51     ` Kamezawa Hiroyuki
2012-07-09 15:17   ` Michal Hocko
2012-07-09 15:17     ` Michal Hocko
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-05  0:45   ` Johannes Weiner
2012-07-09  2:53   ` Kamezawa Hiroyuki
2012-07-09  2:53     ` Kamezawa Hiroyuki
2012-07-09 15:20   ` Michal Hocko
2012-07-09 15:20     ` Michal Hocko
2012-07-09 15:20     ` Michal Hocko
2012-07-10  6:10     ` Wanpeng Li
2012-07-10  6:10       ` Wanpeng Li
2012-07-10  6:10       ` Wanpeng Li
2012-07-10  6:21       ` Michal Hocko
2012-07-10  6:21         ` Michal Hocko
2012-07-10  6:21         ` Michal Hocko
2012-07-10  6:54         ` Wanpeng Li
2012-07-10  6:54           ` Wanpeng Li
2012-07-10 16:22           ` Michal Hocko
2012-07-10 16:22             ` Michal Hocko
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-05  0:45   ` Johannes Weiner
2012-07-09  2:55   ` Kamezawa Hiroyuki
2012-07-09  2:55     ` Kamezawa Hiroyuki
2012-07-09  2:55     ` Kamezawa Hiroyuki
2012-07-09 15:28   ` Michal Hocko
2012-07-09 15:28     ` Michal Hocko
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-05  0:45   ` Johannes Weiner
2012-07-09  3:26   ` Kamezawa Hiroyuki
2012-07-09  3:26     ` Kamezawa Hiroyuki
2012-07-09 15:32   ` Michal Hocko
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-05  0:45   ` Johannes Weiner
2012-07-09  3:44   ` Kamezawa Hiroyuki
2012-07-09  3:44     ` Kamezawa Hiroyuki
2012-07-09  3:44     ` Kamezawa Hiroyuki
2012-07-09 15:34   ` Michal Hocko
2012-07-09 15:34     ` Michal Hocko
2012-07-09 15:34     ` Michal Hocko
2012-07-09 15:35 ` [patch 00/11] mm: memcg: charge/uncharge improvements Michal Hocko
2012-07-09 15:35   ` Michal Hocko
2012-07-09 15:35   ` 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=alpine.LSU.2.00.1207091256540.1842@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.