diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2016-08-29 14:54:53 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2016-08-29 14:54:53 -0400 |
commit | f7ef37af7010f73aeda39d6fba0a7be13f988a08 (patch) | |
tree | e9a5d452f15e1ee43a49eefbaeba5ac19c99136e | |
parent | 9d2477a89f117745c5a8ae64c6cf3ec9ebaea6f2 (diff) | |
download | 4.8-rt-patches-f7ef37af7010f73aeda39d6fba0a7be13f988a08.tar.gz |
mm: page_alloc refresh
-rw-r--r-- | patches/mm-page_alloc-reduce-lock-sections-further.patch | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/patches/mm-page_alloc-reduce-lock-sections-further.patch b/patches/mm-page_alloc-reduce-lock-sections-further.patch index 419cccfceb4d23..ed2bfe346623b7 100644 --- a/patches/mm-page_alloc-reduce-lock-sections-further.patch +++ b/patches/mm-page_alloc-reduce-lock-sections-further.patch @@ -1,20 +1,22 @@ +From 1e2e5ff245661d8fcb342636a4f0008419b6b257 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra <peterz@infradead.org> -Date: Fri Jul 3 08:44:37 2009 -0500 -Subject: mm: page_alloc: Reduce lock sections further +Date: Fri, 3 Jul 2009 08:44:37 -0500 +Subject: [PATCH] mm: page_alloc: Reduce lock sections further Split out the pages which are to be freed into a separate list and call free_pages_bulk() outside of the percpu page allocator locks. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> ---- - mm/page_alloc.c | 87 +++++++++++++++++++++++++++++++++++++++----------------- - 1 file changed, 62 insertions(+), 25 deletions(-) +[PG: update for commit 3777999dd47 and commit 4db7548ccbd9 ] +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index 097068569dc7..a07c534cee60 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c -@@ -829,7 +829,7 @@ static inline int free_pages_check(struc - } +@@ -1082,7 +1082,7 @@ static bool bulkfree_pcp_prepare(struct page *page) + #endif /* CONFIG_DEBUG_VM */ /* - * Frees a number of pages from the PCP lists @@ -22,22 +24,22 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> * Assumes all pages on list are in same zone, and of same order. * count is the number of pages to free. * -@@ -840,18 +840,53 @@ static inline int free_pages_check(struc +@@ -1093,19 +1093,58 @@ static bool bulkfree_pcp_prepare(struct page *page) * pinned" detection logic. */ static void free_pcppages_bulk(struct zone *zone, int count, - struct per_cpu_pages *pcp) + struct list_head *list) { -- int migratetype = 0; -- int batch_free = 0; - int to_free = count; + int migratetype = 0; + int batch_free = 0; unsigned long nr_scanned; + bool isolated_pageblocks; + unsigned long flags; -+ -+ spin_lock_irqsave(&zone->lock, flags); - spin_lock(&zone->lock); ++ spin_lock_irqsave(&zone->lock, flags); + isolated_pageblocks = has_isolate_pageblock(zone); nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); if (nr_scanned) __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); @@ -53,9 +55,12 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> + /* MIGRATE_ISOLATE page should not go to pcplists */ + VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); + /* Pageblock could have been isolated meanwhile */ -+ if (unlikely(has_isolate_pageblock(zone))) ++ if (unlikely(isolated_pageblocks)) + mt = get_pageblock_migratetype(page); + ++ if (bulkfree_pcp_prepare(page)) ++ continue; ++ + __free_one_page(page, page_to_pfn(page), zone, 0, mt); + trace_mm_page_pcpu_drain(page, 0, mt); + to_free--; @@ -77,10 +82,10 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> + int migratetype = 0; + int batch_free = 0; + - while (to_free) { + while (count) { struct page *page; struct list_head *list; -@@ -867,7 +902,7 @@ static void free_pcppages_bulk(struct zo +@@ -1121,7 +1160,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, batch_free++; if (++migratetype == MIGRATE_PCPTYPES) migratetype = 0; @@ -89,8 +94,8 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } while (list_empty(list)); /* This is the only non-empty list. Free them all. */ -@@ -875,24 +910,12 @@ static void free_pcppages_bulk(struct zo - batch_free = to_free; +@@ -1129,27 +1168,10 @@ static void free_pcppages_bulk(struct zone *zone, int count, + batch_free = count; do { - int mt; /* migratetype of the to-be-freed page */ @@ -98,24 +103,26 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> page = list_last_entry(list, struct page, lru); - /* must delete as __free_one_page list manipulates */ list_del(&page->lru); - +- - mt = get_pcppage_migratetype(page); - /* MIGRATE_ISOLATE page should not go to pcplists */ - VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); - /* Pageblock could have been isolated meanwhile */ -- if (unlikely(has_isolate_pageblock(zone))) +- if (unlikely(isolated_pageblocks)) - mt = get_pageblock_migratetype(page); - +- if (bulkfree_pcp_prepare(page)) +- continue; +- - __free_one_page(page, page_to_pfn(page), zone, 0, mt); - trace_mm_page_pcpu_drain(page, 0, mt); -+ list_add(&page->lru, dst); - } while (--to_free && --batch_free && !list_empty(list)); + } while (--count && --batch_free && !list_empty(list)); } - spin_unlock(&zone->lock); } static void free_one_page(struct zone *zone, -@@ -901,7 +924,9 @@ static void free_one_page(struct zone *z +@@ -1158,7 +1180,9 @@ static void free_one_page(struct zone *zone, int migratetype) { unsigned long nr_scanned; @@ -126,7 +133,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> nr_scanned = zone_page_state(zone, NR_PAGES_SCANNED); if (nr_scanned) __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); -@@ -911,7 +936,7 @@ static void free_one_page(struct zone *z +@@ -1168,7 +1192,7 @@ static void free_one_page(struct zone *zone, migratetype = get_pfnblock_migratetype(page, pfn); } __free_one_page(page, pfn, zone, order, migratetype); @@ -134,8 +141,8 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> + spin_unlock_irqrestore(&zone->lock, flags); } - static int free_tail_pages_check(struct page *head_page, struct page *page) -@@ -2030,16 +2055,18 @@ static int rmqueue_bulk(struct zone *zon + static void __meminit __init_single_page(struct page *page, unsigned long pfn, +@@ -2237,16 +2261,18 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp) { unsigned long flags; @@ -155,7 +162,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } #endif -@@ -2055,16 +2082,21 @@ static void drain_pages_zone(unsigned in +@@ -2262,16 +2288,21 @@ static void drain_pages_zone(unsigned int cpu, struct zone *zone) unsigned long flags; struct per_cpu_pageset *pset; struct per_cpu_pages *pcp; @@ -179,7 +186,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } /* -@@ -2242,8 +2274,13 @@ void free_hot_cold_page(struct page *pag +@@ -2453,8 +2484,13 @@ void free_hot_cold_page(struct page *page, bool cold) pcp->count++; if (pcp->count >= pcp->high) { unsigned long batch = READ_ONCE(pcp->batch); @@ -194,3 +201,6 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de> } out: +-- +2.5.0 + |