Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e2c55dc87f4a398b9c4dcc702dbc23a07fe14e23
Commit:     e2c55dc87f4a398b9c4dcc702dbc23a07fe14e23
Parent:     b92a6edd4b77a8794adb497280beea5df5e59a14
Author:     Mel Gorman <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 01:25:50 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 09:42:59 2007 -0700

    Drain per-cpu lists when high-order allocations fail
    
    Per-cpu pages can accidentally cause fragmentation because they are free, 
but
    pinned pages in an otherwise contiguous block.  When this patch is applied,
    the per-cpu caches are drained after the direct-reclaim is entered if the
    requested order is greater than 0.  It simply reuses the code used by 
suspend
    and hotplug.
    
    Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/page_alloc.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fea1e3b..aa7e5d2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -876,7 +876,9 @@ void mark_free_pages(struct zone *zone)
        }
        spin_unlock_irqrestore(&zone->lock, flags);
 }
+#endif /* CONFIG_PM */
 
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_PAGE_GROUP_BY_MOBILITY)
 /*
  * Spill all of this CPU's per-cpu pages back into the buddy allocator.
  */
@@ -888,7 +890,28 @@ void drain_local_pages(void)
        __drain_pages(smp_processor_id());
        local_irq_restore(flags);       
 }
-#endif /* CONFIG_HIBERNATION */
+
+void smp_drain_local_pages(void *arg)
+{
+       drain_local_pages();
+}
+
+/*
+ * Spill all the per-cpu pages from all CPUs back into the buddy allocator
+ */
+void drain_all_local_pages(void)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       __drain_pages(smp_processor_id());
+       local_irq_restore(flags);
+
+       smp_call_function(smp_drain_local_pages, NULL, 0, 1);
+}
+#else
+void drain_all_local_pages(void) {}
+#endif /* CONFIG_HIBERNATION || CONFIG_PAGE_GROUP_BY_MOBILITY */
 
 /*
  * Free a 0-order page
@@ -1480,6 +1503,9 @@ nofail_alloc:
 
        cond_resched();
 
+       if (order != 0)
+               drain_all_local_pages();
+
        if (likely(did_some_progress)) {
                page = get_page_from_freelist(gfp_mask, order,
                                                zonelist, alloc_flags);
-
To unsubscribe from this list: send the line "unsubscribe git-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