ChangeSet 1.2231.1.153, 2005/03/28 19:59:00-08:00, [EMAIL PROTECTED]

        [PATCH] cpusets: alloc GFP_WAIT sleep fix
        
        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).
        
        Thanks to Ray Bryant <[EMAIL PROTECTED]> for noticing this.
        
        Signed-off-by: Paul Jackson <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 mempolicy.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


diff -Nru a/mm/mempolicy.c b/mm/mempolicy.c
--- a/mm/mempolicy.c    2005-03-28 21:40:06 -08:00
+++ b/mm/mempolicy.c    2005-03-28 21:40:06 -08:00
@@ -788,12 +788,16 @@
  *     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;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to