mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
mm: add & use zone_end_pfn() and zone_spans_pfn()
Add 2 helpers (zone_end_pfn() and zone_spans_pfn()) to reduce code duplication. This also switches to using them in compaction (where an additional variable needed to be renamed), page_alloc, vmstat, memory_hotplug, and kmemleak. Note that in compaction.c I avoid calling zone_end_pfn() repeatedly because I expect at some point the sycronization issues with start_pfn & spanned_pages will need fixing, either by actually using the seqlock or clever memory barrier usage. Signed-off-by: Cody P Schafer <[email protected]> Cc: David Hansen <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Mel Gorman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
9127ab4ff9
commit
108bcc96ef
6 changed files with 32 additions and 27 deletions
|
|
@ -86,7 +86,7 @@ static inline bool isolation_suitable(struct compact_control *cc,
|
|||
static void __reset_isolation_suitable(struct zone *zone)
|
||||
{
|
||||
unsigned long start_pfn = zone->zone_start_pfn;
|
||||
unsigned long end_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
||||
unsigned long end_pfn = zone_end_pfn(zone);
|
||||
unsigned long pfn;
|
||||
|
||||
zone->compact_cached_migrate_pfn = start_pfn;
|
||||
|
|
@ -647,7 +647,7 @@ static void isolate_freepages(struct zone *zone,
|
|||
struct compact_control *cc)
|
||||
{
|
||||
struct page *page;
|
||||
unsigned long high_pfn, low_pfn, pfn, zone_end_pfn, end_pfn;
|
||||
unsigned long high_pfn, low_pfn, pfn, z_end_pfn, end_pfn;
|
||||
int nr_freepages = cc->nr_freepages;
|
||||
struct list_head *freelist = &cc->freepages;
|
||||
|
||||
|
|
@ -666,7 +666,7 @@ static void isolate_freepages(struct zone *zone,
|
|||
*/
|
||||
high_pfn = min(low_pfn, pfn);
|
||||
|
||||
zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
||||
z_end_pfn = zone_end_pfn(zone);
|
||||
|
||||
/*
|
||||
* Isolate free pages until enough are available to migrate the
|
||||
|
|
@ -709,7 +709,7 @@ static void isolate_freepages(struct zone *zone,
|
|||
* only scans within a pageblock
|
||||
*/
|
||||
end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
|
||||
end_pfn = min(end_pfn, zone_end_pfn);
|
||||
end_pfn = min(end_pfn, z_end_pfn);
|
||||
isolated = isolate_freepages_block(cc, pfn, end_pfn,
|
||||
freelist, false);
|
||||
nr_freepages += isolated;
|
||||
|
|
@ -923,7 +923,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
|
|||
{
|
||||
int ret;
|
||||
unsigned long start_pfn = zone->zone_start_pfn;
|
||||
unsigned long end_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
||||
unsigned long end_pfn = zone_end_pfn(zone);
|
||||
|
||||
ret = compaction_suitable(zone, cc->order);
|
||||
switch (ret) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue