From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
Paul Menage <menage@google.com>,
linux-mm@kvack.org
Subject: [PATCH 1/7] mm: remove cgroup_mm_owner_callbacks
Date: Thu, 20 Nov 2008 01:11:45 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0811200110180.19216@blonde.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0811200108230.19216@blonde.site>
cgroup_mm_owner_callbacks() was brought in to support the memrlimit
controller, but sneaked into mainline ahead of it. That controller
has now been shelved, and the mm_owner_changed() args were inadequate
for it anyway (they needed an mm pointer instead of a task pointer).
Remove the dead code, and restore mm_update_next_owner() locking to
how it was before: taking mmap_sem there does nothing for memcontrol.c,
now the only user of mm->owner.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
include/linux/cgroup.h | 14 +-------------
kernel/cgroup.c | 33 ---------------------------------
kernel/exit.c | 16 ++++++----------
3 files changed, 7 insertions(+), 56 deletions(-)
--- mmclean0/include/linux/cgroup.h 2008-11-02 23:17:56.000000000 +0000
+++ mmclean1/include/linux/cgroup.h 2008-11-19 15:26:10.000000000 +0000
@@ -329,13 +329,7 @@ struct cgroup_subsys {
struct cgroup *cgrp);
void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
- /*
- * This routine is called with the task_lock of mm->owner held
- */
- void (*mm_owner_changed)(struct cgroup_subsys *ss,
- struct cgroup *old,
- struct cgroup *new,
- struct task_struct *p);
+
int subsys_id;
int active;
int disabled;
@@ -400,9 +394,6 @@ void cgroup_iter_end(struct cgroup *cgrp
int cgroup_scan_tasks(struct cgroup_scanner *scan);
int cgroup_attach_task(struct cgroup *, struct task_struct *);
-void cgroup_mm_owner_callbacks(struct task_struct *old,
- struct task_struct *new);
-
#else /* !CONFIG_CGROUPS */
static inline int cgroup_init_early(void) { return 0; }
@@ -420,9 +411,6 @@ static inline int cgroupstats_build(stru
return -EINVAL;
}
-static inline void cgroup_mm_owner_callbacks(struct task_struct *old,
- struct task_struct *new) {}
-
#endif /* !CONFIG_CGROUPS */
#endif /* _LINUX_CGROUP_H */
--- mmclean0/kernel/cgroup.c 2008-11-19 15:25:12.000000000 +0000
+++ mmclean1/kernel/cgroup.c 2008-11-19 15:26:10.000000000 +0000
@@ -116,7 +116,6 @@ static int root_count;
* be called.
*/
static int need_forkexit_callback __read_mostly;
-static int need_mm_owner_callback __read_mostly;
/* convenient tests for these bits */
inline int cgroup_is_removed(const struct cgroup *cgrp)
@@ -2539,7 +2538,6 @@ static void __init cgroup_init_subsys(st
init_css_set.subsys[ss->subsys_id] = dummytop->subsys[ss->subsys_id];
need_forkexit_callback |= ss->fork || ss->exit;
- need_mm_owner_callback |= !!ss->mm_owner_changed;
/* At system boot, before all subsystems have been
* registered, no tasks have been forked, so we don't
@@ -2789,37 +2787,6 @@ void cgroup_fork_callbacks(struct task_s
}
}
-#ifdef CONFIG_MM_OWNER
-/**
- * cgroup_mm_owner_callbacks - run callbacks when the mm->owner changes
- * @p: the new owner
- *
- * Called on every change to mm->owner. mm_init_owner() does not
- * invoke this routine, since it assigns the mm->owner the first time
- * and does not change it.
- *
- * The callbacks are invoked with mmap_sem held in read mode.
- */
-void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
-{
- struct cgroup *oldcgrp, *newcgrp = NULL;
-
- if (need_mm_owner_callback) {
- int i;
- for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
- struct cgroup_subsys *ss = subsys[i];
- oldcgrp = task_cgroup(old, ss->subsys_id);
- if (new)
- newcgrp = task_cgroup(new, ss->subsys_id);
- if (oldcgrp == newcgrp)
- continue;
- if (ss->mm_owner_changed)
- ss->mm_owner_changed(ss, oldcgrp, newcgrp, new);
- }
- }
-}
-#endif /* CONFIG_MM_OWNER */
-
/**
* cgroup_post_fork - called on a new task after adding it to the task list
* @child: the task in question
--- mmclean0/kernel/exit.c 2008-11-19 15:25:12.000000000 +0000
+++ mmclean1/kernel/exit.c 2008-11-19 15:26:10.000000000 +0000
@@ -638,35 +638,31 @@ retry:
/*
* We found no owner yet mm_users > 1: this implies that we are
* most likely racing with swapoff (try_to_unuse()) or /proc or
- * ptrace or page migration (get_task_mm()). Mark owner as NULL,
- * so that subsystems can understand the callback and take action.
+ * ptrace or page migration (get_task_mm()). Mark owner as NULL.
*/
- down_write(&mm->mmap_sem);
- cgroup_mm_owner_callbacks(mm->owner, NULL);
mm->owner = NULL;
- up_write(&mm->mmap_sem);
return;
assign_new_owner:
BUG_ON(c == p);
get_task_struct(c);
- read_unlock(&tasklist_lock);
- down_write(&mm->mmap_sem);
/*
* The task_lock protects c->mm from changing.
* We always want mm->owner->mm == mm
*/
task_lock(c);
+ /*
+ * Delay read_unlock() till we have the task_lock()
+ * to ensure that c does not slip away underneath us
+ */
+ read_unlock(&tasklist_lock);
if (c->mm != mm) {
task_unlock(c);
- up_write(&mm->mmap_sem);
put_task_struct(c);
goto retry;
}
- cgroup_mm_owner_callbacks(mm->owner, c);
mm->owner = c;
task_unlock(c);
- up_write(&mm->mmap_sem);
put_task_struct(c);
}
#endif /* CONFIG_MM_OWNER */
--
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>
next prev parent reply other threads:[~2008-11-20 1:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 1:10 [PATCH 0/7] mm: cleanups Hugh Dickins
2008-11-20 1:11 ` Hugh Dickins [this message]
2008-11-20 1:23 ` [PATCH 1/7] mm: remove cgroup_mm_owner_callbacks Paul Menage
2008-11-20 1:26 ` Hugh Dickins
2008-11-20 16:41 ` Balbir Singh
2008-11-20 1:14 ` [PATCH 2/7] mm: remove AOP_WRITEPAGE_ACTIVATE Hugh Dickins
2008-11-20 1:16 ` [PATCH 3/7] mm: remove GFP_HIGHUSER_PAGECACHE Hugh Dickins
2008-11-20 16:43 ` Mel Gorman
2008-11-20 18:58 ` Hugh Dickins
2008-11-21 10:46 ` Mel Gorman
2008-11-20 1:17 ` [PATCH 4/7] mm: add Set,ClearPageSwapCache stubs Hugh Dickins
2008-11-20 18:08 ` Christoph Lameter
2008-11-20 1:20 ` [PATCH 5/7] mm: replace some BUG_ONs by VM_BUG_ONs Hugh Dickins
2008-11-20 18:09 ` Christoph Lameter
2008-11-20 1:22 ` [PATCH 6/7] mm: add_active_or_unevictable into rmap Hugh Dickins
2008-11-20 2:08 ` Rik van Riel
2008-11-20 15:18 ` Lee Schermerhorn
2008-11-23 21:51 ` [PATCH 8/7] mm: further cleanup page_add_new_anon_rmap Hugh Dickins
2008-11-23 21:56 ` Rik van Riel
2008-11-23 22:18 ` Hugh Dickins
2008-11-23 22:41 ` Rik van Riel
2008-11-20 1:24 ` [PATCH 7/7] mm: make page_lock_anon_vma static Hugh Dickins
2008-11-21 8:29 ` KOSAKI Motohiro
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=Pine.LNX.4.64.0811200110180.19216@blonde.site \
--to=hugh@veritas.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
/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