UPSTREAM: mm, page_alloc: move draining pcplists to page isolation users
Currently, pcplists are drained during set_migratetype_isolate() which means once per pageblock processed start_isolate_page_range(). This is somewhat wasteful. Moreover, the callers might need different guarantees, and the draining is currently prone to races and does not guarantee that no page from isolated pageblock will end up on the pcplist after the drain. Better guarantees are added by later patches and require explicit actions by page isolation users that need them. Thus it makes sense to move the current imperfect draining to the callers also as a preparation step. Link: https://lkml.kernel.org/r/20201111092812.11329-7-vbabka@suse.cz Suggested-by: David Hildenbrand <david@redhat.com> Suggested-by: Pavel Tatashin <pasha.tatashin@soleen.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Oscar Salvador <osalvador@suse.de> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 7612921f2376d51d020ae2f06ffb7da40422b75b) Change-Id: I10fc574024606c499ddda325d188d181aff7ceec
This commit is contained in:

committed by
Todd Kjos

parent
13bc06efd9
commit
b1e4543c27
@@ -49,7 +49,6 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_
|
||||
|
||||
__mod_zone_freepage_state(zone, -nr_pages, mt);
|
||||
spin_unlock_irqrestore(&zone->lock, flags);
|
||||
drain_all_pages(zone);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -172,11 +171,12 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages)
|
||||
*
|
||||
* Please note that there is no strong synchronization with the page allocator
|
||||
* either. Pages might be freed while their page blocks are marked ISOLATED.
|
||||
* In some cases pages might still end up on pcp lists and that would allow
|
||||
* A call to drain_all_pages() after isolation can flush most of them. However
|
||||
* in some cases pages might still end up on pcp lists and that would allow
|
||||
* for their allocation even when they are in fact isolated already. Depending
|
||||
* on how strong of a guarantee the caller needs drain_all_pages might be needed
|
||||
* (e.g. __offline_pages will need to call it after check for isolated range for
|
||||
* a next retry).
|
||||
* on how strong of a guarantee the caller needs, further drain_all_pages()
|
||||
* might be needed (e.g. __offline_pages will need to call it after check for
|
||||
* isolated range for a next retry).
|
||||
*
|
||||
* Return: 0 on success and -EBUSY if any part of range cannot be isolated.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user