* [PATCH 6/5] cpuset: rebind numa vma mempolicy fix
@ 2005-11-04 8:28 Paul Jackson
2005-11-05 6:38 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Paul Jackson @ 2005-11-04 8:28 UTC (permalink / raw)
To: Andrew Morton
Cc: Simon Derr, Andi Kleen, Paul Jackson, linux-kernel, Christoph Lameter
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 6/5] cpuset: rebind numa vma mempolicy fix
2005-11-04 8:28 [PATCH 6/5] cpuset: rebind numa vma mempolicy fix Paul Jackson
@ 2005-11-05 6:38 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-11-05 6:38 UTC (permalink / raw)
To: Paul Jackson; +Cc: Simon.Derr, ak, pj, linux-kernel, clameter
Paul Jackson <pj@sgi.com> wrote:
>
> 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.
What's the call path? alloc_pages_current() and alloc_page_vma()?
>
> --- 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);
What happens if the task is doing _all_ its allocation under
down_read(mmap_sem)? Like, memset(malloc(lots))? Does all that memory end
up in the wrong place, or what?
Something less hacky^W^W more deterministic would be nice.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-05 6:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04 8:28 [PATCH 6/5] cpuset: rebind numa vma mempolicy fix Paul Jackson
2005-11-05 6:38 ` Andrew Morton
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®