From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: KAMEZAWA Hiroyuki
<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Miklos Szeredi <mszeredi-AlSwsSmVLrQ@public.gmane.org>,
"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org"
<hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Subject: Re: [BUGFIX][PATCH v2] add mem_cgroup_replace_page_cache.
Date: Fri, 9 Dec 2011 12:37:01 -0800 [thread overview]
Message-ID: <20111209123701.7e43dadf.akpm@linux-foundation.org> (raw)
In-Reply-To: <20111208161829.b6101de6.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
On Thu, 8 Dec 2011 16:18:29 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org> wrote:
> commit ef6a3c6311 adds a function replace_page_cache_page(). This
> function replaces a page in radix-tree with a new page.
> At doing this, memory cgroup need to fix up the accounting information.
> memcg need to check PCG_USED bit etc.
>
> In some(many?) case, 'newpage' is on LRU before calling replace_page_cache().
> So, memcg's LRU accounting information should be fixed, too.
>
> This patch adds mem_cgroup_replace_page_cache() and removing old hooks.
> In that function, old pages will be unaccounted without touching res_counter
> and new page will be accounted to the memcg (of old page). At overwriting
> pc->mem_cgroup of newpage, take zone->lru_lock and avoid race with
> LRU handling.
>
> Background:
> replace_page_cache_page() is called by FUSE code in its splice() handling.
> Here, 'newpage' is replacing oldpage but this newpage is not a newly allocated
> page and may be on LRU. LRU mis-accounting will be critical for memory cgroup
> because rmdir() checks the whole LRU is empty and there is no account leak.
> If a page is on the other LRU than it should be, rmdir() will fail.
>
> Changelog: v1 -> v2
> - fixed mem_cgroup_disabled() check missing.
> - added comments.
>
> Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> ---
> include/linux/memcontrol.h | 6 ++++++
> mm/filemap.c | 18 ++----------------
> mm/memcontrol.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+), 16 deletions(-)
It's a relatively intrusive patch and I'm a bit concerned about
feeding it into 3.2.
How serious is the bug, and which kernel version(s) do you think we
should fix it in?
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Miklos Szeredi <mszeredi@suse.cz>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
cgroups@vger.kernel.org,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [BUGFIX][PATCH v2] add mem_cgroup_replace_page_cache.
Date: Fri, 9 Dec 2011 12:37:01 -0800 [thread overview]
Message-ID: <20111209123701.7e43dadf.akpm@linux-foundation.org> (raw)
In-Reply-To: <20111208161829.b6101de6.kamezawa.hiroyu@jp.fujitsu.com>
On Thu, 8 Dec 2011 16:18:29 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> commit ef6a3c6311 adds a function replace_page_cache_page(). This
> function replaces a page in radix-tree with a new page.
> At doing this, memory cgroup need to fix up the accounting information.
> memcg need to check PCG_USED bit etc.
>
> In some(many?) case, 'newpage' is on LRU before calling replace_page_cache().
> So, memcg's LRU accounting information should be fixed, too.
>
> This patch adds mem_cgroup_replace_page_cache() and removing old hooks.
> In that function, old pages will be unaccounted without touching res_counter
> and new page will be accounted to the memcg (of old page). At overwriting
> pc->mem_cgroup of newpage, take zone->lru_lock and avoid race with
> LRU handling.
>
> Background:
> replace_page_cache_page() is called by FUSE code in its splice() handling.
> Here, 'newpage' is replacing oldpage but this newpage is not a newly allocated
> page and may be on LRU. LRU mis-accounting will be critical for memory cgroup
> because rmdir() checks the whole LRU is empty and there is no account leak.
> If a page is on the other LRU than it should be, rmdir() will fail.
>
> Changelog: v1 -> v2
> - fixed mem_cgroup_disabled() check missing.
> - added comments.
>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> include/linux/memcontrol.h | 6 ++++++
> mm/filemap.c | 18 ++----------------
> mm/memcontrol.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+), 16 deletions(-)
It's a relatively intrusive patch and I'm a bit concerned about
feeding it into 3.2.
How serious is the bug, and which kernel version(s) do you think we
should fix it in?
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Miklos Szeredi <mszeredi@suse.cz>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
cgroups@vger.kernel.org,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [BUGFIX][PATCH v2] add mem_cgroup_replace_page_cache.
Date: Fri, 9 Dec 2011 12:37:01 -0800 [thread overview]
Message-ID: <20111209123701.7e43dadf.akpm@linux-foundation.org> (raw)
In-Reply-To: <20111208161829.b6101de6.kamezawa.hiroyu@jp.fujitsu.com>
On Thu, 8 Dec 2011 16:18:29 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> commit ef6a3c6311 adds a function replace_page_cache_page(). This
> function replaces a page in radix-tree with a new page.
> At doing this, memory cgroup need to fix up the accounting information.
> memcg need to check PCG_USED bit etc.
>
> In some(many?) case, 'newpage' is on LRU before calling replace_page_cache().
> So, memcg's LRU accounting information should be fixed, too.
>
> This patch adds mem_cgroup_replace_page_cache() and removing old hooks.
> In that function, old pages will be unaccounted without touching res_counter
> and new page will be accounted to the memcg (of old page). At overwriting
> pc->mem_cgroup of newpage, take zone->lru_lock and avoid race with
> LRU handling.
>
> Background:
> replace_page_cache_page() is called by FUSE code in its splice() handling.
> Here, 'newpage' is replacing oldpage but this newpage is not a newly allocated
> page and may be on LRU. LRU mis-accounting will be critical for memory cgroup
> because rmdir() checks the whole LRU is empty and there is no account leak.
> If a page is on the other LRU than it should be, rmdir() will fail.
>
> Changelog: v1 -> v2
> - fixed mem_cgroup_disabled() check missing.
> - added comments.
>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> include/linux/memcontrol.h | 6 ++++++
> mm/filemap.c | 18 ++----------------
> mm/memcontrol.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+), 16 deletions(-)
It's a relatively intrusive patch and I'm a bit concerned about
feeding it into 3.2.
How serious is the bug, and which kernel version(s) do you think we
should fix it in?
next prev parent reply other threads:[~2011-12-09 20:37 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 3:39 [BUGFIX][PATCH] add mem_cgroup_replace_page_cache KAMEZAWA Hiroyuki
2011-12-06 3:39 ` KAMEZAWA Hiroyuki
2011-12-06 3:39 ` KAMEZAWA Hiroyuki
[not found] ` <20111206123923.1432ab52.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-06 10:12 ` [RFC][PATCH 1/4] memcg: simplify page cache charging KAMEZAWA Hiroyuki
2011-12-06 10:12 ` KAMEZAWA Hiroyuki
2011-12-06 10:12 ` KAMEZAWA Hiroyuki
2011-12-06 10:13 ` [RFC][PATCH 2/4] memcg: simplify corner case handling of LRU and charge races KAMEZAWA Hiroyuki
2011-12-06 10:13 ` KAMEZAWA Hiroyuki
2011-12-06 10:13 ` KAMEZAWA Hiroyuki
[not found] ` <20111206191211.3be32ccb.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-06 10:15 ` [RFC][PATCH 3/4] memcg: clear pc->mem_cgroup if necessary KAMEZAWA Hiroyuki
2011-12-06 10:15 ` KAMEZAWA Hiroyuki
2011-12-06 10:15 ` KAMEZAWA Hiroyuki
2011-12-06 10:17 ` [RFC][PATCH 4/4] memcg: new LRU rule KAMEZAWA Hiroyuki
2011-12-06 10:17 ` KAMEZAWA Hiroyuki
2011-12-06 10:17 ` KAMEZAWA Hiroyuki
2011-12-07 9:21 ` [BUGFIX][PATCH] add mem_cgroup_replace_page_cache Johannes Weiner
2011-12-07 9:21 ` Johannes Weiner
2011-12-07 9:21 ` Johannes Weiner
2011-12-07 11:14 ` Michal Hocko
2011-12-07 11:14 ` Michal Hocko
2011-12-07 11:14 ` Michal Hocko
[not found] ` <20111207111455.GA18249-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2011-12-08 7:18 ` [BUGFIX][PATCH v2] " KAMEZAWA Hiroyuki
2011-12-08 7:18 ` KAMEZAWA Hiroyuki
2011-12-08 7:18 ` KAMEZAWA Hiroyuki
[not found] ` <20111208161829.b6101de6.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-08 9:31 ` Michal Hocko
2011-12-08 9:31 ` Michal Hocko
2011-12-08 9:31 ` Michal Hocko
2011-12-09 20:37 ` Andrew Morton [this message]
2011-12-09 20:37 ` Andrew Morton
2011-12-09 20:37 ` Andrew Morton
2011-12-12 0:48 ` KAMEZAWA Hiroyuki
2011-12-12 0:48 ` KAMEZAWA Hiroyuki
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=20111209123701.7e43dadf.akpm@linux-foundation.org \
--to=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=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
--cc=mszeredi-AlSwsSmVLrQ@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 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.