mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Simon Derr <Simon.Derr@bull.net>, Andi Kleen <ak@suse.de>,
	Paul Jackson <pj@sgi.com>,
	linux-kernel@vger.kernel.org,
	Christoph Lameter <clameter@sgi.com>
Subject: [PATCH 6/5] cpuset: rebind numa vma mempolicy fix
Date: Fri, 4 Nov 2005 00:28:33 -0800 (PST)	[thread overview]
Message-ID: <20051104082833.8786.5266.sendpatchset@jackhammer.engr.sgi.com> (raw)

The patch:
  [PATCH 2/5] cpuset: rebind numa vma mempolicy
requires this fix to avoid a deadlock situation
in certain cpuset removal cases.

It's ok to not complete the refresh_mems() operation
if we notice we are already holding mmap_sem.  We
will try again, next time we allocate memory.

Signed-off-by: Paul Jackson <pj@sgi.com>

---

 (This fix was included in my testing, but in another
  patch that has not been sent in yet.)

 kernel/cpuset.c |    5 +++++
 1 files changed, 5 insertions(+)

--- 2.6.14-rc5-mm1-cpuset-patches.orig/kernel/cpuset.c	2005-11-03 21:18:26.783391082 -0800
+++ 2.6.14-rc5-mm1-cpuset-patches/kernel/cpuset.c	2005-11-03 23:11:15.480042373 -0800
@@ -656,7 +656,12 @@ static void refresh_mems(void)
 	if (current->cpuset_mems_generation != my_cpusets_mem_gen) {
 		struct cpuset *cs;
 		nodemask_t oldmem = current->mems_allowed;
+		struct mm_struct *mm = current->mm;
 
+		/* numa_policy_rebind() needs mmap_sem - don't nest */
+		if (!mm || !down_write_trylock(&mm->mmap_sem))
+			return;
+		up_write(&mm->mmap_sem);
 		down(&callback_sem);
 		task_lock(current);
 		cs = current->cpuset;

-- 
                          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-11-04  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04  8:28 Paul Jackson [this message]
2005-11-05  6:38 ` Andrew Morton

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=20051104082833.8786.5266.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

all inboxes | Powered by JetHome®