Re: [PATCH v3 2/3] mm: Implement folio_remove_rmap_range()

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

 



On Thu, Jul 27, 2023 at 1:26 AM Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
>
> On 27/07/2023 03:35, Matthew Wilcox wrote:
> > On Thu, Jul 27, 2023 at 09:29:24AM +0800, Huang, Ying wrote:
> >> Matthew Wilcox <willy@xxxxxxxxxxxxx> writes:
> >>> 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.
> >
> > Oh, this is removing ... so you're concerned with the case where we've
> > split the PMD into PTEs, but all the PTEs are still present in a single
> > page table?  OK, I don't have a good answer to that.  Maybe that torpedoes
> > the whole idea; I'll think about it.
>
> This is exactly why I think the approach I've already taken is the correct one;
> a 'range' makes no sense when you are dealing with 'compound' pages because you
> are accounting the entire folio. So surely its better to reflect that by only
> accounting small pages in the range version of the API.

If the argument is the compound case is a separate one, then why not a
separate API for it?

I don't really care about whether we think 'range' makes sense for
'compound' or not. What I'm saying is:
1. if they are considered one general case, then one API with the
compound parameter.
2. if they are considered two specific cases, there should be two APIs.
This common design pattern is cleaner IMO.

Right now we have an overlap (redundancy) -- people would have to do
two code searches: one for page_remove_rmap() and the other for
folio_remove_rmap_range(nr=1), and this IMO is a bad design pattern.





[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