Skip to content

Commit

Permalink
mm: cma: skip watermarks check for already isolated blocks in split_f…
Browse files Browse the repository at this point in the history
…ree_page()

Since commit 2139cbe ("cma: fix counting of isolated pages") free
pages in isolated pageblocks are not accounted to NR_FREE_PAGES counters,
so watermarks check is not required if one operates on a free page in
isolated pageblock.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mel Gorman <mel@csn.ul.ie>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Marek Szyprowski authored and Linus Torvalds committed Dec 12, 2012
1 parent e1e12d2 commit 2e30abd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,21 +1394,22 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)

zone = page_zone(page);
order = page_order(page);
mt = get_pageblock_migratetype(page);

/* Obey watermarks as if the page was being allocated */
watermark = low_wmark_pages(zone) + (1 << order);
if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
return 0;
if (mt != MIGRATE_ISOLATE) {
/* Obey watermarks as if the page was being allocated */
watermark = low_wmark_pages(zone) + (1 << order);
if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
return 0;

__mod_zone_freepage_state(zone, -(1UL << alloc_order), mt);
}

/* Remove page from free list */
list_del(&page->lru);
zone->free_area[order].nr_free--;
rmv_page_order(page);

mt = get_pageblock_migratetype(page);
if (unlikely(mt != MIGRATE_ISOLATE))
__mod_zone_freepage_state(zone, -(1UL << alloc_order), mt);

if (alloc_order != order)
expand(zone, page, alloc_order, order,
&zone->free_area[order], migratetype);
Expand Down

0 comments on commit 2e30abd

Please sign in to comment.