From: Paul Jackson <pj@sgi.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@muc.de>,
linux-kernel@vger.kernel.org, Simon Derr <Simon.Derr@bull.net>,
Ray Bryant <raybry@sgi.com>, Paul Jackson <pj@sgi.com>
Subject: [Patch] cpusets alloc GFP_WAIT sleep fix
Date: Fri, 18 Mar 2005 00:17:56 -0800 (PST) [thread overview]
Message-ID: <20050318081757.31530.88116.sendpatchset@sam.engr.sgi.com> (raw)
Linus - please apply.
The cpuset mems_allowed update code in alloc_pages_current could
(in theory) put a task to sleep that didn't allow sleeping (did
not have __GFP_WAIT flag set). In the rare circumstance that
the current tasks mems_generation is outofdate compared to the
tasks cpuset mems_generation, this mems_allowed update code
needs to grap cpuset_sem, which can sleep.
We avoid this by not trying to update mems_allowed here if we
can't sleep (__GFP_WAIT not set).
Applies to top of Linus's bk tree (post 2.6.11)
Thanks to Ray Bryant <raybry@sgi.com> for noticing this.
Signed-off-by: Paul Jackson <pj@sgi.com>
===================================================================
--- 2.6.12-pj.orig/mm/mempolicy.c 2005-03-16 01:16:58.000000000 -0800
+++ 2.6.12-pj/mm/mempolicy.c 2005-03-16 01:32:05.000000000 -0800
@@ -788,12 +788,16 @@ alloc_page_vma(unsigned gfp, struct vm_a
* Allocate a page from the kernel page pool. When not in
* interrupt context and apply the current process NUMA policy.
* Returns NULL when no page can be allocated.
+ *
+ * Don't call cpuset_update_current_mems_allowed() unless
+ * 1) it's ok to take cpuset_sem (can WAIT), and
+ * 2) allocating for current task (not interrupt).
*/
struct page *alloc_pages_current(unsigned gfp, unsigned order)
{
struct mempolicy *pol = current->mempolicy;
- if (!in_interrupt())
+ if ((gfp & __GFP_WAIT) && !in_interrupt())
cpuset_update_current_mems_allowed();
if (!pol || in_interrupt())
pol = &default_policy;
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@engr.sgi.com> 1.650.933.1373, 1.925.600.0401
next reply other threads:[~2005-03-18 8:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-18 8:17 Paul Jackson [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-03-16 10:36 [Patch] cpusets alloc GFP_WAIT sleep fix Paul Jackson
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=20050318081757.31530.88116.sendpatchset@sam.engr.sgi.com \
--to=pj@sgi.com \
--cc=Simon.Derr@bull.net \
--cc=ak@muc.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=raybry@sgi.com \
--cc=torvalds@osdl.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