Re: [PATCH v3] mm, compaction: Skip all non-migratable pages during scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/17/23 12:32, David Hildenbrand wrote:
On 17.05.23 18:15, Khalid Aziz wrote:
Pages pinned in memory through extra refcounts can not be migrated.
Currently as isolate_migratepages_block() scans pages for
compaction, it skips any pinned anonymous pages. All non-migratable
pages should be skipped and not just the anonymous pinned pages.
This patch adds a check for extra refcounts on a page to determine
if the page can be migrated.  This was seen as a real issue on a
customer workload where a large number of pages were pinned by vfio
on the host and any attempts to allocate hugepages resulted in
significant amount of cpu time spent in either direct compaction or
in kcompactd scanning vfio pinned pages over and over again that can
not be migrated.

How will this change affect alloc_contig_range(), such as used for CMA allocations or virtio-mem? alloc_contig_range() ends up calling isolate_migratepages_range() -> isolate_migratepages_block().

We don't want to fail early in case there is a short-term pin that might go away any moment after we isolated ... that will make the situation worse for these use cases, especially if MIGRATE_CMA or ZONE_MOVABLE is involved.


You are right that transitory conditions can be problematic. Wouldn't that apply to anonymous pages as well and we do skip pinned anonymous pages today? A retry would be the right way to handle transitory conditions I think. At the same time, by not scanning long term pinned non-anonymous pages repeatedly, alloc_contig_range() would be helped as well, right?

Nevertheless, we certainly do not want a change that makes overall system behavior worse. Do you see system behavior getting worse, or would the retry in cma_alloc() be sufficient to deal with transitory pins?

Thanks,
Khalid




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux