From: Andrew Morton <akpm@linux-foundation.org>
To: miaox@cn.fujitsu.com
Cc: David Rientjes <rientjes@google.com>,
Nick Piggin <npiggin@suse.de>, Paul Menage <menage@google.com>,
Lee Schermerhorn <lee.schermerhorn@hp.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 2/2] cpuset,mm: fix no node to alloc memory when changing cpuset's mems
Date: Tue, 11 May 2010 18:49:00 -0700 [thread overview]
Message-ID: <20100511184900.8211b6f9.akpm@linux-foundation.org> (raw)
In-Reply-To: <4BDFFCCA.3020906@cn.fujitsu.com>
On Tue, 04 May 2010 18:54:02 +0800
Miao Xie <miaox@cn.fujitsu.com> wrote:
> Before applying this patch, cpuset updates task->mems_allowed and mempolicy by
> setting all new bits in the nodemask first, and clearing all old unallowed bits
> later. But in the way, the allocator may find that there is no node to alloc
> memory.
>
> The reason is that cpuset rebinds the task's mempolicy, it cleans the nodes which
> the allocater can alloc pages on, for example:
> (mpol: mempolicy)
> task1 task1's mpol task2
> alloc page 1
> alloc on node0? NO 1
> 1 change mems from 1 to 0
> 1 rebind task1's mpol
> 0-1 set new bits
> 0 clear disallowed bits
> alloc on node1? NO 0
> ...
> can't alloc page
> goto oom
>
> This patch fixes this problem by expanding the nodes range first(set newly
> allowed bits) and shrink it lazily(clear newly disallowed bits). So we use a
> variable to tell the write-side task that read-side task is reading nodemask,
> and the write-side task clears newly disallowed nodes after read-side task ends
> the current memory allocation.
>
>
> ...
>
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -16,6 +16,7 @@
> #include <linux/key.h>
> #include <linux/security.h>
> #include <linux/cpu.h>
> +#include <linux/cpuset.h>
> #include <linux/acct.h>
> #include <linux/tsacct_kern.h>
> #include <linux/file.h>
> @@ -1003,8 +1004,10 @@ NORET_TYPE void do_exit(long code)
>
> exit_notify(tsk, group_dead);
> #ifdef CONFIG_NUMA
> + task_lock(tsk);
> mpol_put(tsk->mempolicy);
> tsk->mempolicy = NULL;
> + task_unlock(tsk);
> #endif
> #ifdef CONFIG_FUTEX
> if (unlikely(current->pi_state_cache))
Given that this function is already holding task_lock(tsk), this
didn't work very well.
Also, why was the inclusion of cpuset.h added? Nothing which this
patch adds appears to need it?
--
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:[~2010-05-12 1:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 10:54 [PATCH 2/2] cpuset,mm: fix no node to alloc memory when changing cpuset's mems Miao Xie
2010-05-12 1:49 ` Andrew Morton [this message]
2010-05-12 6:16 ` Miao Xie
2010-05-12 3:22 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2010-04-22 14:12 Miao Xie
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=20100511184900.8211b6f9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=lee.schermerhorn@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=miaox@cn.fujitsu.com \
--cc=npiggin@suse.de \
--cc=rientjes@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;
as well as URLs for NNTP newsgroup(s).