All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <5720C753.2000804@suse.cz>

diff --git a/a/1.txt b/N1/1.txt
index 05f2413..77add86 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -53,3 +53,84 @@ Acked-by: Vlastimil Babka <vbabka@suse.cz>
 
 Unlike the free path, there are no duplications here, which is nice.
 Some un-inlining of bad page check should still work here though imho:
+
+>From afdefd87f2d8d07cba4bd2a2f3531dc8bb0b7a19 Mon Sep 17 00:00:00 2001
+From: Vlastimil Babka <vbabka@suse.cz>
+Date: Wed, 27 Apr 2016 15:47:29 +0200
+Subject: [PATCH] mm, page_alloc: uninline the bad page part of
+ check_new_page()
+
+Bad pages should be rare so the code handling them doesn't need to be inline
+for performance reasons. Put it to separate function which returns void.
+This also assumes that the initial page_expected_state() result will match the
+result of the thorough check, i.e. the page doesn't become "good" in the
+meanwhile. This matches the same expectations already in place in
+free_pages_check().
+
+!DEBUG_VM bloat-o-meter:
+
+add/remove: 1/0 grow/shrink: 0/1 up/down: 134/-274 (-140)
+function                                     old     new   delta
+check_new_page_bad                             -     134    +134
+get_page_from_freelist                      3468    3194    -274
+
+Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
+---
+ mm/page_alloc.c | 33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index 2b3aefdfcaa2..755ec9465d8a 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -1648,19 +1648,11 @@ static inline void expand(struct zone *zone, struct page *page,
+ 	}
+ }
+ 
+-/*
+- * This page is about to be returned from the page allocator
+- */
+-static inline int check_new_page(struct page *page)
++static void check_new_page_bad(struct page *page)
+ {
+-	const char *bad_reason;
+-	unsigned long bad_flags;
++	const char *bad_reason = NULL;
++	unsigned long bad_flags = 0;
+ 
+-	if (page_expected_state(page, PAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON))
+-		return 0;
+-
+-	bad_reason = NULL;
+-	bad_flags = 0;
+ 	if (unlikely(atomic_read(&page->_mapcount) != -1))
+ 		bad_reason = "nonzero mapcount";
+ 	if (unlikely(page->mapping != NULL))
+@@ -1679,11 +1671,20 @@ static inline int check_new_page(struct page *page)
+ 	if (unlikely(page->mem_cgroup))
+ 		bad_reason = "page still charged to cgroup";
+ #endif
+-	if (unlikely(bad_reason)) {
+-		bad_page(page, bad_reason, bad_flags);
+-		return 1;
+-	}
+-	return 0;
++	bad_page(page, bad_reason, bad_flags);
++}
++
++/*
++ * This page is about to be returned from the page allocator
++ */
++static inline int check_new_page(struct page *page)
++{
++	if (likely(page_expected_state(page,
++				PAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON)))
++		return 0;
++
++	check_new_page_bad(page);
++	return 1;
+ }
+ 
+ static inline bool free_pages_prezeroed(bool poisoned)
+-- 
+2.8.1
diff --git a/a/content_digest b/N1/content_digest
index 9f312ec..b645799 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -65,6 +65,87 @@
  "Acked-by: Vlastimil Babka <vbabka@suse.cz>\n"
  "\n"
  "Unlike the free path, there are no duplications here, which is nice.\n"
- Some un-inlining of bad page check should still work here though imho:
+ "Some un-inlining of bad page check should still work here though imho:\n"
+ "\n"
+ ">From afdefd87f2d8d07cba4bd2a2f3531dc8bb0b7a19 Mon Sep 17 00:00:00 2001\n"
+ "From: Vlastimil Babka <vbabka@suse.cz>\n"
+ "Date: Wed, 27 Apr 2016 15:47:29 +0200\n"
+ "Subject: [PATCH] mm, page_alloc: uninline the bad page part of\n"
+ " check_new_page()\n"
+ "\n"
+ "Bad pages should be rare so the code handling them doesn't need to be inline\n"
+ "for performance reasons. Put it to separate function which returns void.\n"
+ "This also assumes that the initial page_expected_state() result will match the\n"
+ "result of the thorough check, i.e. the page doesn't become \"good\" in the\n"
+ "meanwhile. This matches the same expectations already in place in\n"
+ "free_pages_check().\n"
+ "\n"
+ "!DEBUG_VM bloat-o-meter:\n"
+ "\n"
+ "add/remove: 1/0 grow/shrink: 0/1 up/down: 134/-274 (-140)\n"
+ "function                                     old     new   delta\n"
+ "check_new_page_bad                             -     134    +134\n"
+ "get_page_from_freelist                      3468    3194    -274\n"
+ "\n"
+ "Signed-off-by: Vlastimil Babka <vbabka@suse.cz>\n"
+ "---\n"
+ " mm/page_alloc.c | 33 +++++++++++++++++----------------\n"
+ " 1 file changed, 17 insertions(+), 16 deletions(-)\n"
+ "\n"
+ "diff --git a/mm/page_alloc.c b/mm/page_alloc.c\n"
+ "index 2b3aefdfcaa2..755ec9465d8a 100644\n"
+ "--- a/mm/page_alloc.c\n"
+ "+++ b/mm/page_alloc.c\n"
+ "@@ -1648,19 +1648,11 @@ static inline void expand(struct zone *zone, struct page *page,\n"
+ " \t}\n"
+ " }\n"
+ " \n"
+ "-/*\n"
+ "- * This page is about to be returned from the page allocator\n"
+ "- */\n"
+ "-static inline int check_new_page(struct page *page)\n"
+ "+static void check_new_page_bad(struct page *page)\n"
+ " {\n"
+ "-\tconst char *bad_reason;\n"
+ "-\tunsigned long bad_flags;\n"
+ "+\tconst char *bad_reason = NULL;\n"
+ "+\tunsigned long bad_flags = 0;\n"
+ " \n"
+ "-\tif (page_expected_state(page, PAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON))\n"
+ "-\t\treturn 0;\n"
+ "-\n"
+ "-\tbad_reason = NULL;\n"
+ "-\tbad_flags = 0;\n"
+ " \tif (unlikely(atomic_read(&page->_mapcount) != -1))\n"
+ " \t\tbad_reason = \"nonzero mapcount\";\n"
+ " \tif (unlikely(page->mapping != NULL))\n"
+ "@@ -1679,11 +1671,20 @@ static inline int check_new_page(struct page *page)\n"
+ " \tif (unlikely(page->mem_cgroup))\n"
+ " \t\tbad_reason = \"page still charged to cgroup\";\n"
+ " #endif\n"
+ "-\tif (unlikely(bad_reason)) {\n"
+ "-\t\tbad_page(page, bad_reason, bad_flags);\n"
+ "-\t\treturn 1;\n"
+ "-\t}\n"
+ "-\treturn 0;\n"
+ "+\tbad_page(page, bad_reason, bad_flags);\n"
+ "+}\n"
+ "+\n"
+ "+/*\n"
+ "+ * This page is about to be returned from the page allocator\n"
+ "+ */\n"
+ "+static inline int check_new_page(struct page *page)\n"
+ "+{\n"
+ "+\tif (likely(page_expected_state(page,\n"
+ "+\t\t\t\tPAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON)))\n"
+ "+\t\treturn 0;\n"
+ "+\n"
+ "+\tcheck_new_page_bad(page);\n"
+ "+\treturn 1;\n"
+ " }\n"
+ " \n"
+ " static inline bool free_pages_prezeroed(bool poisoned)\n"
+ "-- \n"
+ 2.8.1
 
-27764fdded5563d994f5984f1486f0424aca3191adfa8499f1e7d2a26592d061
+dec706bfe7b018cebd401e4d191599511c196282a71d3589766d3e70a00e929d

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.