lkml.org 
[lkml]   [2023]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 2/3] mm: Implement folio_remove_rmap_range()
Date
Matthew Wilcox <willy@infradead.org> writes:

> On Tue, Jul 25, 2023 at 11:53:26PM -0600, Yu Zhao wrote:
>> > +void folio_remove_rmap_range(struct folio *folio, struct page *page,
>> > + int nr, struct vm_area_struct *vma);
>>
>> I prefer folio_remove_rmap_range(page, nr, vma). Passing both the
>> folio and the starting page seems redundant to me.
>>
>> Matthew, is there a convention (function names, parameters, etc.) for
>> operations on a range of pages within a folio?
>
> We've been establishing that convention recently, yes. It seems
> pointless to re-derive the folio from the page when the caller already
> has the folio. I also like Ryan's point that it reinforces that all
> pages must be from the same folio.
>
>> And regarding the refactor, what I have in mind is that
>> folio_remove_rmap_range() is the core API and page_remove_rmap() is
>> just a wrapper around it, i.e., folio_remove_rmap_range(page, 1, vma).
>>
>> Let me post a diff later and see if it makes sense to you.
>
> I think that can make sense. Because we limit to a single page table,
> specifying 'nr = 1 << PMD_ORDER' is the same as 'compound = true'.
> Just make it folio, page, nr, vma. I'd actually prefer it as (vma,
> folio, page, nr), but that isn't the convention we've had in rmap up
> until now.

IIUC, even if 'nr = 1 << PMD_ORDER', we may remove one PMD 'compound'
mapping, or 'nr' PTE mapping. So, we will still need 'compound' (or
some better name) as parameter.

--
Best Regards,
Huang, Ying

\
 
 \ /
  Last update: 2023-07-27 03:32    [W:0.072 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site