mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Subject: [BUGFIX][PATCH(resend) mmotm] memcg: try_get_mem_cgroup_from_swapcache fix (Re: 2.6.30 -mm merge plans)
Date: Tue, 24 Mar 2009 16:57:43 +0900	[thread overview]
Message-ID: <20090324165743.bfaefecb.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20090323224615.cd29edfd.akpm@linux-foundation.org>

>     memcg-use-css-id.patch
>     memcg-hierarchical-stat.patch
>     memcg-fix-shrinking-memory-to-return-ebusy-by-fixing-retry-algorithm.patch
>     memcg-fix-oom-killer-under-memcg.patch
>     memcg-fix-oom-killer-under-memcg-fix2.patch
>     memcg-fix-oom-killer-under-memcg-fix.patch
>     memcg-show-memcg-information-during-oom.patch
>     memcg-show-memcg-information-during-oom-fix2.patch
>     memcg-show-memcg-information-during-oom-fix.patch
>     memcg-show-memcg-information-during-oom-fix-fix.patch
>     memcg-show-memcg-information-during-oom-fix-fix-checkpatch-fixes.patch
>     memcg-remove-mem_cgroup_calc_mapped_ratio-take2.patch
>     memcg-remove-mem_cgroup_reclaim_imbalance-remnants.patch
>     memcg-charge-swapcache-to-proper-memcg.patch
>     cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch
>     memcg-remove-redundant-message-at-swapon.patch
> 
>  Merge
> 
This patch is fix for cgroups-use-css-id-in-swap-cgroup-for-saving-memory-v5.patch.

I think it would be better to fold them.

===
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>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com>
---

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

  reply	other threads:[~2009-03-24  8:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24  5:46 2.6.30 -mm merge plans Andrew Morton
2009-03-24  7:57 ` Daisuke Nishimura [this message]
2009-03-24 21:48 ` one more tty reference leak [Was: 2.6.30 -mm merge plans] Jiri Slaby
2009-03-24 22:01   ` Jiri Slaby
2009-03-25  1:26 ` sd-async-shutdown.patch [was: " Robert Hancock
2009-03-25  1:29   ` Shaohua Li
2009-03-25 16:24 ` 2.6.30 -mm merge plans Kumar Gala
2009-03-25 17:14 ` Coly Li

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=20090324165743.bfaefecb.nishimura@mxp.nes.nec.co.jp \
    --to=nishimura@mxp.nes.nec.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®