Skip to content

Commit 49255c6

Browse files
gormanmtorvalds
authored andcommitted
page allocator: move check for disabled anti-fragmentation out of fastpath
On low-memory systems, anti-fragmentation gets disabled as there is nothing it can do and it would just incur overhead shuffling pages between lists constantly. Currently the check is made in the free page fast path for every page. This patch moves it to a slow path. On machines with low memory, there will be small amount of additional overhead as pages get shuffled between lists but it should quickly settle. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Dave Hansen <dave@linux.vnet.ibm.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 11e33f6 commit 49255c6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

include/linux/mmzone.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled;
5050

5151
static inline int get_pageblock_migratetype(struct page *page)
5252
{
53-
if (unlikely(page_group_by_mobility_disabled))
54-
return MIGRATE_UNMOVABLE;
55-
5653
return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
5754
}
5855

mm/page_alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ int page_group_by_mobility_disabled __read_mostly;
168168

169169
static void set_pageblock_migratetype(struct page *page, int migratetype)
170170
{
171+
172+
if (unlikely(page_group_by_mobility_disabled))
173+
migratetype = MIGRATE_UNMOVABLE;
174+
171175
set_pageblock_flags_group(page, (unsigned long)migratetype,
172176
PB_migrate, PB_migrate_end);
173177
}

0 commit comments

Comments
 (0)