[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOUHufamqn0b8tN1DppfPi7FRnENzYwcSOVcAKNxkj=CYa+OwQ@mail.gmail.com>
Date: Tue, 25 Jul 2023 23:53:26 -0600
From: Yu Zhao <yuzhao@...gle.com>
To: Ryan Roberts <ryan.roberts@....com>,
Matthew Wilcox <willy@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Yin Fengwei <fengwei.yin@...el.com>,
David Hildenbrand <david@...hat.com>,
Yang Shi <shy828301@...il.com>,
"Huang, Ying" <ying.huang@...el.com>, Zi Yan <ziy@...dia.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v3 2/3] mm: Implement folio_remove_rmap_range()
On Thu, Jul 20, 2023 at 5:30 AM Ryan Roberts <ryan.roberts@....com> wrote:
>
> Like page_remove_rmap() but batch-removes the rmap for a range of pages
> belonging to a folio. This can provide a small speedup due to less
> manipuation of the various counters. But more crucially, if removing the
> rmap for all pages of a folio in a batch, there is no need to
> (spuriously) add it to the deferred split list, which saves significant
> cost when there is contention for the split queue lock.
>
> All contained pages are accounted using the order-0 folio (or base page)
> scheme.
>
> page_remove_rmap() is refactored so that it forwards to
> folio_remove_rmap_range() for !compound cases, and both functions now
> share a common epilogue function. The intention here is to avoid
> duplication of code.
>
> Signed-off-by: Ryan Roberts <ryan.roberts@....com>
> ---
> include/linux/rmap.h | 2 +
> mm/rmap.c | 125 ++++++++++++++++++++++++++++++++-----------
> 2 files changed, 97 insertions(+), 30 deletions(-)
>
> diff --git a/include/linux/rmap.h b/include/linux/rmap.h
> index b87d01660412..f578975c12c0 100644
> --- a/include/linux/rmap.h
> +++ b/include/linux/rmap.h
> @@ -200,6 +200,8 @@ void page_add_file_rmap(struct page *, struct vm_area_struct *,
> bool compound);
> void page_remove_rmap(struct page *, struct vm_area_struct *,
> bool compound);
> +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?
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.
Powered by blists - more mailing lists