summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@techsingularity.net>2016-05-19 20:14:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 22:12:14 -0400
commitda838d4fcba675cbf864f225d76f970e91220ee6 (patch)
tree165448850b88e5ce309ea92cc955c91836c868a4 /mm/page_alloc.c
parentbb552ac6c6b4f24e7a7b491286f87b63f9478d42 (diff)
mm, page_alloc: pull out side effects from free_pages_check
Check without side-effects should be easier to maintain. It also removes the duplicated cpupid and flags reset done in !DEBUG_VM variant of both free_pcp_prepare() and then bulkfree_pcp_prepare(). Finally, it enables the next patch. It shouldn't result in new branches, thanks to inlining of the check. !DEBUG_VM bloat-o-meter: add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-27 (-27) function old new delta __free_pages_ok 748 739 -9 free_pcppages_bulk 1403 1385 -18 DEBUG_VM: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-28 (-28) function old new delta free_pages_prepare 806 778 -28 This is also slightly faster because cpupid information is not set on tail pages so we can avoid resets there. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d51543de1813..fea50b0cb405 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -833,11 +833,8 @@ static void free_pages_check_bad(struct page *page)
833 833
834static inline int free_pages_check(struct page *page) 834static inline int free_pages_check(struct page *page)
835{ 835{
836 if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE))) { 836 if (likely(page_expected_state(page, PAGE_FLAGS_CHECK_AT_FREE)))
837 page_cpupid_reset_last(page);
838 page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
839 return 0; 837 return 0;
840 }
841 838
842 /* Something has gone sideways, find it */ 839 /* Something has gone sideways, find it */
843 free_pages_check_bad(page); 840 free_pages_check_bad(page);
@@ -1078,7 +1075,11 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
1078 for (i = 1; i < (1 << order); i++) { 1075 for (i = 1; i < (1 << order); i++) {
1079 if (compound) 1076 if (compound)
1080 bad += free_tail_pages_check(page, page + i); 1077 bad += free_tail_pages_check(page, page + i);
1081 bad += free_pages_check(page + i); 1078 if (unlikely(free_pages_check(page + i))) {
1079 bad++;
1080 continue;
1081 }
1082 (page + i)->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
1082 } 1083 }
1083 } 1084 }
1084 if (PageAnonHead(page)) 1085 if (PageAnonHead(page))
@@ -1087,6 +1088,8 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
1087 if (bad) 1088 if (bad)
1088 return false; 1089 return false;
1089 1090
1091 page_cpupid_reset_last(page);
1092 page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
1090 reset_page_owner(page, order); 1093 reset_page_owner(page, order);
1091 1094
1092 if (!PageHighMem(page)) { 1095 if (!PageHighMem(page)) {