lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090324165743.bfaefecb.nishimura@mxp.nes.nec.co.jp>
Date:	Tue, 24 Mar 2009 16:57:43 +0900
From:	Daisuke Nishimura <nishimura@....nes.nec.co.jp>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>
Subject: [BUGFIX][PATCH(resend) mmotm] memcg:
 try_get_mem_cgroup_from_swapcache fix (Re: 2.6.30 -mm merge plans)

>     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@....nes.nec.co.jp>

css_tryget can be called twice in !PageCgroupUsed case.

Signed-off-by: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ