All of lore.kernel.org
 help / color / mirror / Atom feed
* - memory-cgroup-enhancements-add-pre_destroy-handler.patch removed from -mm tree
@ 2007-11-06  7:14 akpm
       [not found] ` <20071106164447.98fa9032.kamezawa.hiroyu@jp.fujitsu.com>
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2007-11-06  7:14 UTC (permalink / raw)
  To: kamezawa.hiroyu, a.p.zijlstra, balbir, dev, ebiederm, herbert,
	menage, nickpiggin


The patch titled
     memory cgroup enhancements: add pre_destroy handler
has been removed from the -mm tree.  Its filename was
     memory-cgroup-enhancements-add-pre_destroy-handler.patch

This patch was dropped because I can't get it to compile - new version after next -mm, please

------------------------------------------------------
Subject: memory cgroup enhancements: add pre_destroy handler
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

My main purpose of this patch is for memory controller..

This patch adds a handler "pre_destroy" to cgroup_subsys.
It is called before cgroup_rmdir() checks all subsys's refcnt.

I think this is useful for subsys which have some extra refs even if there are
no tasks in cgroup.  By adding pre_destroy(), the kernel keeps the rule
"destroy() against subsystem is called only when refcnt=0." and allows css ref
to be used by other objects than tasks.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Pavel Emelianov <xemul@openvz.org>
Cc: Paul Menage <menage@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Kirill Korotaev <dev@sw.ru>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: David Rientjes <rientjes@google.com>
Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/cgroup.h |    1 +
 kernel/cgroup.c        |    7 +++++++
 2 files changed, 8 insertions(+)

diff -puN include/linux/cgroup.h~memory-cgroup-enhancements-add-pre_destroy-handler include/linux/cgroup.h
--- a/include/linux/cgroup.h~memory-cgroup-enhancements-add-pre_destroy-handler
+++ a/include/linux/cgroup.h
@@ -233,6 +233,7 @@ int cgroup_is_descendant(const struct cg
 struct cgroup_subsys {
 	struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
 						  struct cgroup *cont);
+	void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
 	void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
 	int (*can_attach)(struct cgroup_subsys *ss,
 			  struct cgroup *cont, struct task_struct *tsk);
diff -puN kernel/cgroup.c~memory-cgroup-enhancements-add-pre_destroy-handler kernel/cgroup.c
--- a/kernel/cgroup.c~memory-cgroup-enhancements-add-pre_destroy-handler
+++ a/kernel/cgroup.c
@@ -2162,6 +2162,13 @@ static int cgroup_rmdir(struct inode *un
 	parent = cgrp->parent;
 	root = cgrp->root;
 	sb = root->sb;
+	/*
+	 * Notify subsyses that rmdir() request comes.
+	 */
+	for_each_subsys(root, ss) {
+		if ((cont->subsys[ss->subsys_id]) && ss->pre_destroy)
+			ss->pre_destroy(ss, cont);
+	}
 
 	if (cgroup_has_css_refs(cgrp)) {
 		mutex_unlock(&cgroup_mutex);
_

Patches currently in -mm which might be from kamezawa.hiroyu@jp.fujitsu.com are

origin.patch
memory-hotremove-unset-migrate-type-isolate-after-removal.patch
memory-hotplug-add-removable-to-sysfs-to-show-memblock-removability.patch
add-remove_memory-for-ppc64-2.patch
enable-hotplug-memory-remove-for-ppc64.patch
add-arch-specific-walk_memory_remove-for-ppc64.patch
pie-executable-randomization.patch
pie-executable-randomization-checkpatch-fixes.patch
memory-controller-make-charging-gfp-mask-aware-fix.patch
bugfix-for-memory-cgroup-controller-charge-refcnt-race-fix.patch
bugfix-for-memory-cgroup-controller-fix-error-handling-path-in-mem_charge_cgroup.patch
bugfix-for-memory-controller-add-helper-function-for-assigning-cgroup-to-page.patch
bugfix-for-memory-cgroup-controller-avoid-pagelru-page-in-mem_cgroup_isolate_pages.patch
bugfix-for-memory-cgroup-controller-avoid-pagelru-page-in-mem_cgroup_isolate_pages-fix.patch
bugfix-for-memory-cgroup-controller-migration-under-memory-controller-fix.patch
memory-cgroup-enhancements-fix-zone-handling-in-try_to_free_mem_cgroup_page.patch
memory-cgroup-enhancements-force_empty-interface-for-dropping-all-account-in-empty-cgroup.patch
memory-cgroup-enhancements-remember-a-page-is-charged-as-page-cache.patch
memory-cgroup-enhancements-remember-a-page-is-on-active-list-of-cgroup-or-not.patch
memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup.patch
memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-checkpatch-fixes.patch
memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-1.patch
memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-uninlining.patch
memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-2.patch
memory-cgroup-enhancements-add-memorystat-file.patch
memory-cgroup-enhancements-add-memorystat-file-checkpatch-fixes.patch
memory-cgroup-enhancements-add-pre_destroy-handler.patch
memory-cgroup-enhancements-add-pre_destroy-handler-fix.patch
memory-cgroup-enhancements-implicit-force-empty-at-rmdir.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: - memory-cgroup-enhancements-add-pre_destroy-handler.patch removed from -mm tree
       [not found] ` <20071106164447.98fa9032.kamezawa.hiroyu@jp.fujitsu.com>
@ 2007-11-06  7:50   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-11-06  7:50 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: a.p.zijlstra, balbir, dev, ebiederm, herbert, menage, nickpiggin,
	rientjes, svaidy, xemul, mm-commits

On Tue, 6 Nov 2007 16:44:47 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Mon, 05 Nov 2007 23:14:40 -0800
> akpm@linux-foundation.org wrote:
> 
> > 
> > The patch titled
> >      memory cgroup enhancements: add pre_destroy handler
> > has been removed from the -mm tree.  Its filename was
> >      memory-cgroup-enhancements-add-pre_destroy-handler.patch
> > 
> > This patch was dropped because I can't get it to compile - new version after next -mm, please
> > 
> 
> Hmm, ok. I'll reschedule this and next one.

Thanks.

> But is there objections to pre_destroy handler ?

Dunno, I haven't been paying much attention.  Has anyone else?  It's a bit
suspicious that nobody noticed that this would cause obvious build
errors.

More reviewing effort please, guys.

> If we should deal with reference count of following in another way,
> ==
>    page->page_cgroup->memory_cgroup, memory_cgroup contains css.
>    page_cgroup has ref to css.
> ==
> I'll consider something. (for example, add refcnt to memory_cgroup itself.)
> 
> Changing above may allow us to guarantee that if no task, css's refcnt is 0.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* - memory-cgroup-enhancements-add-pre_destroy-handler.patch removed from -mm tree
@ 2008-02-08  8:04 akpm
  0 siblings, 0 replies; 3+ messages in thread
From: akpm @ 2008-02-08  8:04 UTC (permalink / raw)
  To: kamezawa.hiroyu, a.p.zijlstra, balbir, dev, ebiederm, herbert,
	menage, nickpiggin


The patch titled
     memory cgroup enhancements: add- pre_destroy() handler
has been removed from the -mm tree.  Its filename was
     memory-cgroup-enhancements-add-pre_destroy-handler.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: memory cgroup enhancements: add- pre_destroy() handler
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Add a handler "pre_destroy" to cgroup_subsys.  It is called before
cgroup_rmdir() checks all subsys's refcnt.

I think this is useful for subsys which have some extra refs even if there
are no tasks in cgroup.  By adding pre_destroy(), the kernel keeps the rule
"destroy() against subsystem is called only when refcnt=0." and allows css
ref to be used by other objects than tasks.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Kirill Korotaev <dev@sw.ru>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Paul Menage <menage@google.com>
Cc: Pavel Emelianov <xemul@openvz.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/cgroup.h |    1 +
 kernel/cgroup.c        |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff -puN include/linux/cgroup.h~memory-cgroup-enhancements-add-pre_destroy-handler include/linux/cgroup.h
--- a/include/linux/cgroup.h~memory-cgroup-enhancements-add-pre_destroy-handler
+++ a/include/linux/cgroup.h
@@ -233,6 +233,7 @@ int cgroup_is_descendant(const struct cg
 struct cgroup_subsys {
 	struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
 						  struct cgroup *cont);
+	void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
 	void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
 	int (*can_attach)(struct cgroup_subsys *ss,
 			  struct cgroup *cont, struct task_struct *tsk);
diff -puN kernel/cgroup.c~memory-cgroup-enhancements-add-pre_destroy-handler kernel/cgroup.c
--- a/kernel/cgroup.c~memory-cgroup-enhancements-add-pre_destroy-handler
+++ a/kernel/cgroup.c
@@ -586,6 +586,21 @@ static struct inode *cgroup_new_inode(mo
 	return inode;
 }
 
+/*
+ * Call subsys's pre_destroy handler.
+ * This is called before css refcnt check.
+ */
+
+static void cgroup_call_pre_destroy(struct cgroup *cgrp)
+{
+	struct cgroup_subsys *ss;
+	for_each_subsys(cgrp->root, ss)
+		if (ss->pre_destroy && cgrp->subsys[ss->subsys_id])
+			ss->pre_destroy(ss, cgrp);
+	return;
+}
+
+
 static void cgroup_diput(struct dentry *dentry, struct inode *inode)
 {
 	/* is dentry a directory ? if so, kfree() associated cgroup */
@@ -2160,6 +2175,13 @@ static int cgroup_rmdir(struct inode *un
 	parent = cgrp->parent;
 	root = cgrp->root;
 	sb = root->sb;
+	/*
+	 * Call pre_destroy handlers of subsys
+	 */
+	cgroup_call_pre_destroy(cgrp);
+	/*
+	 * Notify subsyses that rmdir() request comes.
+	 */
 
 	if (cgroup_has_css_refs(cgrp)) {
 		mutex_unlock(&cgroup_mutex);
_

Patches currently in -mm which might be from kamezawa.hiroyu@jp.fujitsu.com are

origin.patch
enable-hotplug-memory-remove-for-ppc64.patch
add-arch-specific-walk_memory_remove-for-ppc64.patch
memory-hotplug-add-removable-to-sysfs-to-show-memblock-removability.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-08  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06  7:14 - memory-cgroup-enhancements-add-pre_destroy-handler.patch removed from -mm tree akpm
     [not found] ` <20071106164447.98fa9032.kamezawa.hiroyu@jp.fujitsu.com>
2007-11-06  7:50   ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2008-02-08  8:04 akpm

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.