Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5adc5be7cd1bcef6bb64f5255d2a33f20a3cf5be
Commit:     5adc5be7cd1bcef6bb64f5255d2a33f20a3cf5be
Parent:     9ef9acb05a741ec10a5e9122717736de12adced9
Author:     Mel Gorman <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 01:25:54 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 09:43:00 2007 -0700

    Bias the placement of kernel pages at lower PFNs
    
    This patch chooses blocks with lower PFNs when placing kernel allocations.
    This is particularly important during fallback in low memory situations to
    stop unmovable pages being placed throughout the entire address space.
    
    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 |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 676aec9..e1d87ee 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -765,6 +765,23 @@ int move_freepages_block(struct zone *zone, struct page 
*page, int migratetype)
        return move_freepages(zone, start_page, end_page, migratetype);
 }
 
+/* Return the page with the lowest PFN in the list */
+static struct page *min_page(struct list_head *list)
+{
+       unsigned long min_pfn = -1UL;
+       struct page *min_page = NULL, *page;;
+
+       list_for_each_entry(page, list, lru) {
+               unsigned long pfn = page_to_pfn(page);
+               if (pfn < min_pfn) {
+                       min_pfn = pfn;
+                       min_page = page;
+               }
+       }
+
+       return min_page;
+}
+
 /* Remove an element from the buddy allocator from the fallback list */
 static struct page *__rmqueue_fallback(struct zone *zone, int order,
                                                int start_migratetype)
@@ -795,8 +812,11 @@ retry:
                        if (list_empty(&area->free_list[migratetype]))
                                continue;
 
+                       /* Bias kernel allocations towards low pfns */
                        page = list_entry(area->free_list[migratetype].next,
                                        struct page, lru);
+                       if (unlikely(start_migratetype != MIGRATE_MOVABLE))
+                               page = min_page(&area->free_list[migratetype]);
                        area->nr_free--;
 
                        /*
-
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