lkml.org 
[lkml]   [2023]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4] mm, compaction: Skip all non-migratable pages during scan
From
On 26.05.23 18:44, Matthew Wilcox wrote:
> On Fri, May 26, 2023 at 09:44:34AM -0600, Khalid Aziz wrote:
>>> Oh, I think I found it! pin_user_pages_remote() is called by
>>> vaddr_get_pfns(). If these are the pages you're concerned about,
>>> then the efficient way to do what you want is simply to call
>>> folio_maybe_dma_pinned(). Far more efficient than the current mess
>>> of total_mapcount().
>>
>> vfio pinned pages triggered this change. Wouldn't checking refcounts against
>> mapcount provide a more generalized way of detecting non-migratable pages?
>
> Well, you changed the comment to say that we were concerned about
> long-term pins. If we are, than folio_maybe_dma_pinned() is how to test
> for long-term pins. If we want to skip pages which are short-term pinned,
> then we need to not change the comment, and keep using mapcount/refcount
> differences.
>

folio_maybe_dma_pinned() is all about FOLL_PIN, not FOLL_LONGTERM.

folio_maybe_dma_pinned() would skip migrating any page that has more
than 1024 references. (shared libraries?)

--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2023-05-26 18:48    [W:0.080 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site