* [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix
@ 2009-03-22 15:02 Daisuke Nishimura
2009-03-22 18:40 ` Balbir Singh
2009-03-23 0:03 ` KAMEZAWA Hiroyuki
0 siblings, 2 replies; 5+ messages in thread
From: Daisuke Nishimura @ 2009-03-22 15:02 UTC (permalink / raw)
To: Andrew Morton
Cc: Balbir Singh, KAMEZAWA Hiroyuki, Daisuke Nishimura, linux-mm
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
css_tryget can be called twice in !PageCgroupUsed case.
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
---
This is a fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
mm/memcontrol.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5de6be9..55dea59 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1027,9 +1027,11 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
/*
* Used bit of swapcache is solid under page lock.
*/
- if (PageCgroupUsed(pc))
+ if (PageCgroupUsed(pc)) {
mem = pc->mem_cgroup;
- else {
+ if (mem && !css_tryget(&mem->css))
+ mem = NULL;
+ } else {
ent.val = page_private(page);
id = lookup_swap_cgroup(ent);
rcu_read_lock();
@@ -1038,10 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
mem = NULL;
rcu_read_unlock();
}
- if (!mem)
- return NULL;
- if (!css_tryget(&mem->css))
- return NULL;
return mem;
}
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix
2009-03-22 15:02 [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix Daisuke Nishimura
@ 2009-03-22 18:40 ` Balbir Singh
2009-03-23 0:13 ` Daisuke Nishimura
2009-03-23 0:03 ` KAMEZAWA Hiroyuki
1 sibling, 1 reply; 5+ messages in thread
From: Balbir Singh @ 2009-03-22 18:40 UTC (permalink / raw)
To: nishimura; +Cc: Andrew Morton, KAMEZAWA Hiroyuki, linux-mm
* Daisuke Nishimura <d-nishimura@mtf.biglobe.ne.jp> [2009-03-23 00:02:38]:
> From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
>
> css_tryget can be called twice in !PageCgroupUsed case.
>
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> ---
> This is a fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
>
> mm/memcontrol.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 5de6be9..55dea59 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1027,9 +1027,11 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> /*
> * Used bit of swapcache is solid under page lock.
> */
> - if (PageCgroupUsed(pc))
> + if (PageCgroupUsed(pc)) {
> mem = pc->mem_cgroup;
> - else {
> + if (mem && !css_tryget(&mem->css))
> + mem = NULL;
> + } else {
> ent.val = page_private(page);
> id = lookup_swap_cgroup(ent);
> rcu_read_lock();
> @@ -1038,10 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> mem = NULL;
> rcu_read_unlock();
> }
> - if (!mem)
> - return NULL;
> - if (!css_tryget(&mem->css))
> - return NULL;
> return mem;
> }
How did you detect the problem? Any test case/steps to reproduce the issue?
--
Balbir
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix
2009-03-22 15:02 [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix Daisuke Nishimura
2009-03-22 18:40 ` Balbir Singh
@ 2009-03-23 0:03 ` KAMEZAWA Hiroyuki
1 sibling, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-03-23 0:03 UTC (permalink / raw)
To: nishimura; +Cc: Daisuke Nishimura, Andrew Morton, Balbir Singh, linux-mm
On Mon, 23 Mar 2009 00:02:38 +0900
Daisuke Nishimura <d-nishimura@mtf.biglobe.ne.jp> wrote:
> From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
>
> css_tryget can be called twice in !PageCgroupUsed case.
>
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Thank you
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com>
> ---
> This is a fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
>
> mm/memcontrol.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 5de6be9..55dea59 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1027,9 +1027,11 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> /*
> * Used bit of swapcache is solid under page lock.
> */
> - if (PageCgroupUsed(pc))
> + if (PageCgroupUsed(pc)) {
> mem = pc->mem_cgroup;
> - else {
> + if (mem && !css_tryget(&mem->css))
> + mem = NULL;
> + } else {
> ent.val = page_private(page);
> id = lookup_swap_cgroup(ent);
> rcu_read_lock();
> @@ -1038,10 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> mem = NULL;
> rcu_read_unlock();
> }
> - if (!mem)
> - return NULL;
> - if (!css_tryget(&mem->css))
> - return NULL;
> return mem;
> }
>
>
>
>
>
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix
2009-03-22 18:40 ` Balbir Singh
@ 2009-03-23 0:13 ` Daisuke Nishimura
2009-03-23 0:19 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 5+ messages in thread
From: Daisuke Nishimura @ 2009-03-23 0:13 UTC (permalink / raw)
To: balbir; +Cc: nishimura, Andrew Morton, KAMEZAWA Hiroyuki, linux-mm
On Mon, 23 Mar 2009 00:10:15 +0530, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> * Daisuke Nishimura <d-nishimura@mtf.biglobe.ne.jp> [2009-03-23 00:02:38]:
>
> > From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> >
> > css_tryget can be called twice in !PageCgroupUsed case.
> >
> > Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> > ---
> > This is a fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
> >
> > mm/memcontrol.c | 10 ++++------
> > 1 files changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 5de6be9..55dea59 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -1027,9 +1027,11 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> > /*
> > * Used bit of swapcache is solid under page lock.
> > */
> > - if (PageCgroupUsed(pc))
> > + if (PageCgroupUsed(pc)) {
> > mem = pc->mem_cgroup;
> > - else {
> > + if (mem && !css_tryget(&mem->css))
> > + mem = NULL;
> > + } else {
> > ent.val = page_private(page);
> > id = lookup_swap_cgroup(ent);
> > rcu_read_lock();
> > @@ -1038,10 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> > mem = NULL;
> > rcu_read_unlock();
> > }
> > - if (!mem)
> > - return NULL;
> > - if (!css_tryget(&mem->css))
> > - return NULL;
> > return mem;
> > }
>
> How did you detect the problem? Any test case/steps to reproduce the issue?
>
I found this when rebasing my patch onto mmotm and reviewing it.
I suppose this bug can leads to an unremovable directory.
Thanks,
Daisuke Nishimura.
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix
2009-03-23 0:13 ` Daisuke Nishimura
@ 2009-03-23 0:19 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-03-23 0:19 UTC (permalink / raw)
To: Daisuke Nishimura; +Cc: balbir, Andrew Morton, linux-mm
On Mon, 23 Mar 2009 09:13:37 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
> On Mon, 23 Mar 2009 00:10:15 +0530, Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > * Daisuke Nishimura <d-nishimura@mtf.biglobe.ne.jp> [2009-03-23 00:02:38]:
> >
> > > From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> > >
> > > css_tryget can be called twice in !PageCgroupUsed case.
> > >
> > > Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> > > ---
> > > This is a fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
> > >
> > > mm/memcontrol.c | 10 ++++------
> > > 1 files changed, 4 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > > index 5de6be9..55dea59 100644
> > > --- a/mm/memcontrol.c
> > > +++ b/mm/memcontrol.c
> > > @@ -1027,9 +1027,11 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> > > /*
> > > * Used bit of swapcache is solid under page lock.
> > > */
> > > - if (PageCgroupUsed(pc))
> > > + if (PageCgroupUsed(pc)) {
> > > mem = pc->mem_cgroup;
> > > - else {
> > > + if (mem && !css_tryget(&mem->css))
> > > + mem = NULL;
> > > + } else {
> > > ent.val = page_private(page);
> > > id = lookup_swap_cgroup(ent);
> > > rcu_read_lock();
> > > @@ -1038,10 +1040,6 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
> > > mem = NULL;
> > > rcu_read_unlock();
> > > }
> > > - if (!mem)
> > > - return NULL;
> > > - if (!css_tryget(&mem->css))
> > > - return NULL;
> > > return mem;
> > > }
> >
> > How did you detect the problem? Any test case/steps to reproduce the issue?
> >
> I found this when rebasing my patch onto mmotm and reviewing it.
>
> I suppose this bug can leads to an unremovable directory.
>
I think I saw this in the weekend but couldn't find why ;(
Thank you!
-Kame
>
> Thanks,
> Daisuke Nishimura.
>
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-03-22 23:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-22 15:02 [BUGFIX][PATCH mmotm] memcg: try_get_mem_cgroup_from_swapcache fix Daisuke Nishimura
2009-03-22 18:40 ` Balbir Singh
2009-03-23 0:13 ` Daisuke Nishimura
2009-03-23 0:19 ` KAMEZAWA Hiroyuki
2009-03-23 0:03 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox