diff for duplicates of <20090320152313.GL24586@csn.ul.ie> diff --git a/a/1.txt b/N1/1.txt index 31d4f6c..4691cb5 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -137,157 +137,3 @@ to have destroy_compound_page() that only does real work for DEBUG_VM as free_pages_check() already does enough work. ==== - ->From 93f9b5ebae0000ae3e7985c98680226f4bdd90a8 Mon Sep 17 00:00:00 2001 -From: Mel Gorman <mel@csn.ul.ie> -Date: Mon, 9 Mar 2009 11:56:56 +0000 -Subject: [PATCH 32/34] Allow compound pages to be stored on the PCP lists - -The SLUB allocator frees and allocates compound pages. The setup costs -for compound pages are noticeable in profiles and incur cache misses as -every struct page has to be checked and written. This patch allows -compound pages to be stored on the PCP list to save on teardown and -setup time. - -Signed-off-by: Mel Gorman <mel@csn.ul.ie> ---- - include/linux/page-flags.h | 4 ++- - mm/page_alloc.c | 56 ++++++++++++++++++++++++++++++------------- - 2 files changed, 42 insertions(+), 18 deletions(-) - -diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h -index 219a523..4177ec1 100644 ---- a/include/linux/page-flags.h -+++ b/include/linux/page-flags.h -@@ -388,7 +388,9 @@ static inline void __ClearPageTail(struct page *page) - * Pages being prepped should not have any flags set. It they are set, - * there has been a kernel bug or struct page corruption. - */ --#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) -+#define PAGE_FLAGS_CHECK_AT_PREP_BUDDY ((1 << NR_PAGEFLAGS) - 1) -+#define PAGE_FLAGS_CHECK_AT_PREP (((1 << NR_PAGEFLAGS) - 1) & \ -+ ~(1 << PG_head | 1 << PG_tail)) - - #endif /* !__GENERATING_BOUNDS_H */ - #endif /* PAGE_FLAGS_H */ -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 253fd98..2941638 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -280,11 +280,7 @@ out: - * put_page() function. Its ->lru.prev holds the order of allocation. - * This usage means that zero-order pages may not be compound. - */ -- --static void free_compound_page(struct page *page) --{ -- __free_pages_ok(page, compound_order(page)); --} -+static void free_compound_page(struct page *page); - - void prep_compound_page(struct page *page, unsigned long order) - { -@@ -553,7 +549,9 @@ static inline void __free_one_page(struct page *page, - zone->free_area[page_order(page)].nr_free++; - } - --static inline int free_pages_check(struct page *page) -+/* Sanity check a free pages flags */ -+static inline int check_freepage_flags(struct page *page, -+ unsigned long prepflags) - { - if (unlikely(page_mapcount(page) | - (page->mapping != NULL) | -@@ -562,8 +560,8 @@ static inline int free_pages_check(struct page *page) - bad_page(page); - return 1; - } -- if (page->flags & PAGE_FLAGS_CHECK_AT_PREP) -- page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; -+ if (page->flags & prepflags) -+ page->flags &= ~prepflags; - return 0; - } - -@@ -602,6 +600,12 @@ static int free_pcppages_bulk(struct zone *zone, int count, - page = list_entry(list->prev, struct page, lru); - freed += 1 << page->index; - list_del(&page->lru); -+ -+ /* SLUB can have compound pages to the free lists */ -+ if (unlikely(PageCompound(page))) -+ if (unlikely(destroy_compound_page(page, page->index))) -+ continue; -+ - __free_one_page(page, zone, page->index, migratetype); - } - spin_unlock(&zone->lock); -@@ -633,8 +637,10 @@ static void __free_pages_ok(struct page *page, unsigned int order) - int bad = 0; - int clearMlocked = PageMlocked(page); - -+ VM_BUG_ON(PageCompound(page)); - for (i = 0 ; i < (1 << order) ; ++i) -- bad += free_pages_check(page + i); -+ bad += check_freepage_flags(page + i, -+ PAGE_FLAGS_CHECK_AT_PREP_BUDDY); - if (bad) - return; - -@@ -738,8 +744,20 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags) - if (gfp_flags & __GFP_ZERO) - prep_zero_page(page, order, gfp_flags); - -- if (order && (gfp_flags & __GFP_COMP)) -- prep_compound_page(page, order); -+ /* -+ * If a compound page is requested, we have to check the page being -+ * prepped. If it's already compound, we leave it alone. If a -+ * compound page is not requested but the page being prepped is -+ * compound, then it must be destroyed -+ */ -+ if (order) { -+ if ((gfp_flags & __GFP_COMP) && !PageCompound(page)) -+ prep_compound_page(page, order); -+ -+ if (!(gfp_flags & __GFP_COMP) && PageCompound(page)) -+ if (unlikely(destroy_compound_page(page, order))) -+ return 1; -+ } - - return 0; - } -@@ -1105,14 +1123,9 @@ static void free_hot_cold_page(struct page *page, int order, int cold) - int migratetype; - int clearMlocked = PageMlocked(page); - -- /* SLUB can return lowish-order compound pages that need handling */ -- if (order > 0 && unlikely(PageCompound(page))) -- if (unlikely(destroy_compound_page(page, order))) -- return; -- - if (PageAnon(page)) - page->mapping = NULL; -- if (free_pages_check(page)) -+ if (check_freepage_flags(page, PAGE_FLAGS_CHECK_AT_PREP)) - return; - - if (!PageHighMem(page)) { -@@ -1160,6 +1173,15 @@ out: - put_cpu(); - } - -+static void free_compound_page(struct page *page) -+{ -+ unsigned int order = compound_order(page); -+ if (order <= PAGE_ALLOC_COSTLY_ORDER) -+ free_hot_cold_page(page, order, 0); -+ else -+ __free_pages_ok(page, order); -+} -+ - void free_hot_page(struct page *page) - { - free_hot_cold_page(page, 0, 0); --- -1.5.6.5 diff --git a/a/content_digest b/N1/content_digest index 4f9cf91..2949f20 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -154,160 +154,6 @@ "to have destroy_compound_page() that only does real work for DEBUG_VM as\n" "free_pages_check() already does enough work.\n" "\n" - "====\n" - "\n" - ">From 93f9b5ebae0000ae3e7985c98680226f4bdd90a8 Mon Sep 17 00:00:00 2001\n" - "From: Mel Gorman <mel@csn.ul.ie>\n" - "Date: Mon, 9 Mar 2009 11:56:56 +0000\n" - "Subject: [PATCH 32/34] Allow compound pages to be stored on the PCP lists\n" - "\n" - "The SLUB allocator frees and allocates compound pages. The setup costs\n" - "for compound pages are noticeable in profiles and incur cache misses as\n" - "every struct page has to be checked and written. This patch allows\n" - "compound pages to be stored on the PCP list to save on teardown and\n" - "setup time.\n" - "\n" - "Signed-off-by: Mel Gorman <mel@csn.ul.ie>\n" - "---\n" - " include/linux/page-flags.h | 4 ++-\n" - " mm/page_alloc.c | 56 ++++++++++++++++++++++++++++++-------------\n" - " 2 files changed, 42 insertions(+), 18 deletions(-)\n" - "\n" - "diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h\n" - "index 219a523..4177ec1 100644\n" - "--- a/include/linux/page-flags.h\n" - "+++ b/include/linux/page-flags.h\n" - "@@ -388,7 +388,9 @@ static inline void __ClearPageTail(struct page *page)\n" - " * Pages being prepped should not have any flags set. It they are set,\n" - " * there has been a kernel bug or struct page corruption.\n" - " */\n" - "-#define PAGE_FLAGS_CHECK_AT_PREP\t((1 << NR_PAGEFLAGS) - 1)\n" - "+#define PAGE_FLAGS_CHECK_AT_PREP_BUDDY\t((1 << NR_PAGEFLAGS) - 1)\n" - "+#define PAGE_FLAGS_CHECK_AT_PREP\t(((1 << NR_PAGEFLAGS) - 1) & \\\n" - "+\t\t\t\t\t~(1 << PG_head | 1 << PG_tail))\n" - " \n" - " #endif /* !__GENERATING_BOUNDS_H */\n" - " #endif\t/* PAGE_FLAGS_H */\n" - "diff --git a/mm/page_alloc.c b/mm/page_alloc.c\n" - "index 253fd98..2941638 100644\n" - "--- a/mm/page_alloc.c\n" - "+++ b/mm/page_alloc.c\n" - "@@ -280,11 +280,7 @@ out:\n" - " * put_page() function. Its ->lru.prev holds the order of allocation.\n" - " * This usage means that zero-order pages may not be compound.\n" - " */\n" - "-\n" - "-static void free_compound_page(struct page *page)\n" - "-{\n" - "-\t__free_pages_ok(page, compound_order(page));\n" - "-}\n" - "+static void free_compound_page(struct page *page);\n" - " \n" - " void prep_compound_page(struct page *page, unsigned long order)\n" - " {\n" - "@@ -553,7 +549,9 @@ static inline void __free_one_page(struct page *page,\n" - " \tzone->free_area[page_order(page)].nr_free++;\n" - " }\n" - " \n" - "-static inline int free_pages_check(struct page *page)\n" - "+/* Sanity check a free pages flags */\n" - "+static inline int check_freepage_flags(struct page *page,\n" - "+\t\t\t\t\t\tunsigned long prepflags)\n" - " {\n" - " \tif (unlikely(page_mapcount(page) |\n" - " \t\t(page->mapping != NULL) |\n" - "@@ -562,8 +560,8 @@ static inline int free_pages_check(struct page *page)\n" - " \t\tbad_page(page);\n" - " \t\treturn 1;\n" - " \t}\n" - "-\tif (page->flags & PAGE_FLAGS_CHECK_AT_PREP)\n" - "-\t\tpage->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;\n" - "+\tif (page->flags & prepflags)\n" - "+\t\tpage->flags &= ~prepflags;\n" - " \treturn 0;\n" - " }\n" - " \n" - "@@ -602,6 +600,12 @@ static int free_pcppages_bulk(struct zone *zone, int count,\n" - " \t\tpage = list_entry(list->prev, struct page, lru);\n" - " \t\tfreed += 1 << page->index;\n" - " \t\tlist_del(&page->lru);\n" - "+\n" - "+\t\t/* SLUB can have compound pages to the free lists */\n" - "+\t\tif (unlikely(PageCompound(page)))\n" - "+\t\t\tif (unlikely(destroy_compound_page(page, page->index)))\n" - "+\t\t\t\tcontinue;\n" - "+\n" - " \t\t__free_one_page(page, zone, page->index, migratetype);\n" - " \t}\n" - " \tspin_unlock(&zone->lock);\n" - "@@ -633,8 +637,10 @@ static void __free_pages_ok(struct page *page, unsigned int order)\n" - " \tint bad = 0;\n" - " \tint clearMlocked = PageMlocked(page);\n" - " \n" - "+\tVM_BUG_ON(PageCompound(page));\n" - " \tfor (i = 0 ; i < (1 << order) ; ++i)\n" - "-\t\tbad += free_pages_check(page + i);\n" - "+\t\tbad += check_freepage_flags(page + i,\n" - "+\t\t\t\t\tPAGE_FLAGS_CHECK_AT_PREP_BUDDY);\n" - " \tif (bad)\n" - " \t\treturn;\n" - " \n" - "@@ -738,8 +744,20 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags)\n" - " \tif (gfp_flags & __GFP_ZERO)\n" - " \t\tprep_zero_page(page, order, gfp_flags);\n" - " \n" - "-\tif (order && (gfp_flags & __GFP_COMP))\n" - "-\t\tprep_compound_page(page, order);\n" - "+\t/*\n" - "+\t * If a compound page is requested, we have to check the page being\n" - "+\t * prepped. If it's already compound, we leave it alone. If a\n" - "+\t * compound page is not requested but the page being prepped is\n" - "+\t * compound, then it must be destroyed\n" - "+\t */\n" - "+\tif (order) {\n" - "+\t\tif ((gfp_flags & __GFP_COMP) && !PageCompound(page))\n" - "+\t\t\tprep_compound_page(page, order);\n" - "+\n" - "+\t\tif (!(gfp_flags & __GFP_COMP) && PageCompound(page))\n" - "+\t\t\tif (unlikely(destroy_compound_page(page, order)))\n" - "+\t\t\t\treturn 1;\n" - "+\t}\n" - " \n" - " \treturn 0;\n" - " }\n" - "@@ -1105,14 +1123,9 @@ static void free_hot_cold_page(struct page *page, int order, int cold)\n" - " \tint migratetype;\n" - " \tint clearMlocked = PageMlocked(page);\n" - " \n" - "-\t/* SLUB can return lowish-order compound pages that need handling */\n" - "-\tif (order > 0 && unlikely(PageCompound(page)))\n" - "-\t\tif (unlikely(destroy_compound_page(page, order)))\n" - "-\t\t\treturn;\n" - "-\n" - " \tif (PageAnon(page))\n" - " \t\tpage->mapping = NULL;\n" - "-\tif (free_pages_check(page))\n" - "+\tif (check_freepage_flags(page, PAGE_FLAGS_CHECK_AT_PREP))\n" - " \t\treturn;\n" - " \n" - " \tif (!PageHighMem(page)) {\n" - "@@ -1160,6 +1173,15 @@ out:\n" - " \tput_cpu();\n" - " }\n" - " \n" - "+static void free_compound_page(struct page *page)\n" - "+{\n" - "+\tunsigned int order = compound_order(page);\n" - "+\tif (order <= PAGE_ALLOC_COSTLY_ORDER)\n" - "+\t\tfree_hot_cold_page(page, order, 0);\n" - "+\telse\n" - "+\t\t__free_pages_ok(page, order);\n" - "+}\n" - "+\n" - " void free_hot_page(struct page *page)\n" - " {\n" - " \tfree_hot_cold_page(page, 0, 0);\n" - "-- \n" - 1.5.6.5 + ==== -fca42fda75dd056f13399834f515654eb1db47f4b0e45707d75bff8f31178548 +4d0a8ec46204114b78fc3ca7c9f7e87676faa470692ca9cb96b410b1e5f46966
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.