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: <20090115192712.33b533c3.kamezawa.hiroyu@jp.fujitsu.com>
Date:	Thu, 15 Jan 2009 19:27:12 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"menage@...gle.com" <menage@...gle.com>,
	"lizf@...fujitsu.com" <lizf@...fujitsu.com>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: [PATCH 2/4] cgroup:add css_is_populated

From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>

cgroup creation is done in several stages.
After allocated and linked to cgroup's hierarchy tree, all necessary
control files are created.

When using CSS_ID, scanning cgroups without cgrouo_lock(), status
of cgroup is important. At removal of cgroup/css, css_tryget() works fine
and we can write a safe code. At creation, we need some flag to show 
"This cgroup is not ready yet"

This patch adds CSS_POPULATED flag.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>

---
Index: mmotm-2.6.29-Jan14/include/linux/cgroup.h
===================================================================
--- mmotm-2.6.29-Jan14.orig/include/linux/cgroup.h
+++ mmotm-2.6.29-Jan14/include/linux/cgroup.h
@@ -69,6 +69,7 @@ struct cgroup_subsys_state {
 enum {
 	CSS_ROOT, /* This CSS is the root of the subsystem */
 	CSS_REMOVED, /* This CSS is dead */
+	CSS_POPULATED, /* This CSS finished all initialization */
 };
 
 /*
@@ -90,6 +91,11 @@ static inline bool css_is_removed(struct
 	return test_bit(CSS_REMOVED, &css->flags);
 }
 
+static inline bool css_is_populated(struct cgroup_subsys_state *css)
+{
+	return test_bit(CSS_POPULATED, &css->flags);
+}
+
 /*
  * Call css_tryget() to take a reference on a css if your existing
  * (known-valid) reference isn't already ref-counted. Returns false if
Index: mmotm-2.6.29-Jan14/kernel/cgroup.c
===================================================================
--- mmotm-2.6.29-Jan14.orig/kernel/cgroup.c
+++ mmotm-2.6.29-Jan14/kernel/cgroup.c
@@ -2326,8 +2326,10 @@ static int cgroup_populate_dir(struct cg
 	}
 
 	for_each_subsys(cgrp->root, ss) {
+		struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
 		if (ss->populate && (err = ss->populate(ss, cgrp)) < 0)
 			return err;
+		set_bit(CSS_POPULATED, &css->flags);
 	}
 
 	return 0;

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