soc: qcom: mem-offline: don't collect more than SWAP_CLUSTER_MAX pages
In migrating the pages to movable zone, zone->lock is acquired and then we try to isolate free pages from the movable zone. In doing so, we are checking if SWAP_CLUSTER_MAX pages are isolated at the page block boundaries but this condition may not be reached as the PageBuddy() turns to be false leading to looping for longer duration with zone->lock held. Move these checks to the start of the loop. Change-Id: Ic903ff410521472246f7739f04206dc05ff204be Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
This commit is contained in:
parent
5a3bdfd150
commit
c244039099
@ -1084,6 +1084,15 @@ static void isolate_free_pages(struct movable_zone_fill_control *fc)
|
||||
start_pfn += pageblock_nr_pages - 1;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Make sure that the zone->lock is not held for long by
|
||||
* returning once we have SWAP_CLUSTER_MAX pages in the
|
||||
* free list for migration.
|
||||
*/
|
||||
if (!(start_pfn % pageblock_nr_pages) &&
|
||||
(fc->nr_free_pages >= SWAP_CLUSTER_MAX ||
|
||||
has_pend_offline_req))
|
||||
break;
|
||||
|
||||
if (!PageBuddy(page))
|
||||
continue;
|
||||
@ -1093,18 +1102,8 @@ static void isolate_free_pages(struct movable_zone_fill_control *fc)
|
||||
list_splice(&tmp, &fc->freepages);
|
||||
fc->nr_free_pages += isolated;
|
||||
start_pfn += isolated - 1;
|
||||
|
||||
/*
|
||||
* Make sure that the zone->lock is not held for long by
|
||||
* returning once we have SWAP_CLUSTER_MAX pages in the
|
||||
* free list for migration.
|
||||
*/
|
||||
if (!((start_pfn + 1) % pageblock_nr_pages) &&
|
||||
(fc->nr_free_pages >= SWAP_CLUSTER_MAX ||
|
||||
has_pend_offline_req))
|
||||
break;
|
||||
}
|
||||
fc->start_pfn = start_pfn + 1;
|
||||
fc->start_pfn = start_pfn;
|
||||
spin_unlock_irqrestore(&fc->zone->lock, flags);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user