From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Simon Derr <Simon.Derr@bull.net>,
Paul Jackson <pj@sgi.com>, Andi Kleen <ak@suse.de>,
Christoph Lameter <clameter@sgi.com>
Subject: [PATCH] Cpuset: cant mmput inside tasklist_lock fix
Date: Sat, 10 Dec 2005 02:39:02 -0800 (PST) [thread overview]
Message-ID: <20051210103902.20736.14870.sendpatchset@jackhammer.engr.sgi.com> (raw)
mmput() inside tasklist_lock() can deadlock (thanks, Andrew).
To fix, move the range check before getting the mm, so the mm
doesn't have to be mmput if the check failed.
Also the BUG() was excessively cruel (panics) for this case.
Even though "it can't happen", still it is easy to carry
on and keep the kernel healthy, at the penalty of not placing
memory exactly where the user expected.
Signed-off-by: Paul Jackson <pj@sgi.com>
---
kernel/cpuset.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
--- 2.6.15-rc3-mm1.orig/kernel/cpuset.c 2005-12-10 01:06:00.717770568 -0800
+++ 2.6.15-rc3-mm1/kernel/cpuset.c 2005-12-10 01:29:23.604065478 -0800
@@ -881,20 +881,16 @@ static int update_nodemask(struct cpuset
do_each_thread(g, p) {
struct mm_struct *mm;
+ if (n >= ntasks) {
+ printk(KERN_WARNING
+ "Cpuset mempolicy rebind incomplete.\n");
+ continue;
+ }
if (p->cpuset != cs)
continue;
mm = get_task_mm(p);
if (!mm)
continue;
- if (n >= ntasks) {
- if (printk_ratelimit()) {
- printk (KERN_ERR
- "Cpuset mempolicy rebind failed.\n");
- BUG();
- }
- mmput(mm);
- continue;
- }
mmarray[n++] = mm;
} while_each_thread(g, p);
write_unlock_irq(&tasklist_lock);
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373
reply other threads:[~2005-12-10 10:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20051210103902.20736.14870.sendpatchset@jackhammer.engr.sgi.com \
--to=pj@sgi.com \
--cc=Simon.Derr@bull.net \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=clameter@sgi.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
Powered by JetHome