[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74f4367a-f821-4e0f-9e9c-d4f1221bcb07@amd.com>
Date: Mon, 23 Jun 2025 08:15:30 +0200
From: "Gupta, Pankaj" <pankaj.gupta@....com>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
Shivank Garg <shivankg@....com>, seanjc@...gle.com, david@...hat.com,
vbabka@...e.cz, akpm@...ux-foundation.org, shuah@...nel.org,
pbonzini@...hat.com, brauner@...nel.org, viro@...iv.linux.org.uk
Cc: ackerleytng@...gle.com, paul@...l-moore.com, jmorris@...ei.org,
serge@...lyn.com, pvorel@...e.cz, bfoster@...hat.com, tabba@...gle.com,
vannapurve@...gle.com, chao.gao@...el.com, bharata@....com, nikunj@....com,
michael.day@....com, yan.y.zhao@...el.com, Neeraj.Upadhyay@....com,
thomas.lendacky@....com, michael.roth@....com, aik@....com, jgg@...dia.com,
kalyazin@...zon.com, peterx@...hat.com, jack@...e.cz, rppt@...nel.org,
hch@...radead.org, cgzones@...glemail.com, ira.weiny@...el.com,
rientjes@...gle.com, roypat@...zon.co.uk, ziy@...dia.com,
matthew.brost@...el.com, joshua.hahnjy@...il.com, rakie.kim@...com,
byungchul@...com, gourry@...rry.net, kent.overstreet@...ux.dev,
ying.huang@...ux.alibaba.com, apopple@...dia.com, chao.p.peng@...el.com,
amit@...radead.org, ddutile@...hat.com, dan.j.williams@...el.com,
ashish.kalra@....com, gshan@...hat.com, jgowans@...zon.com,
papaluri@....com, yuzhao@...gle.com, suzuki.poulose@....com,
quic_eberman@...cinc.com, aneeshkumar.kizhakeveetil@....com,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-security-module@...r.kernel.org,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-coco@...ts.linux.dev
Subject: Re: [PATCH 2/2] filemap: Add __filemap_get_folio_mpol()
> This allows guest_memfd to pass in a memory policy.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Reviewed-by: Pankaj Gupta <pankaj.gupta@....com>
> ---
> include/linux/pagemap.h | 10 ++++++++--
> mm/filemap.c | 10 ++++++----
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index c176aeeb38db..1cfbf7b8f573 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -745,11 +745,17 @@ static inline fgf_t fgf_set_order(size_t size)
> }
>
> void *filemap_get_entry(struct address_space *mapping, pgoff_t index);
> -struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
> - fgf_t fgp_flags, gfp_t gfp);
> +struct folio *__filemap_get_folio_mpol(struct address_space *mapping,
> + pgoff_t index, fgf_t fgf_flags, gfp_t gfp, struct mempolicy *);
> struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
> fgf_t fgp_flags, gfp_t gfp);
>
> +static inline struct folio *__filemap_get_folio(struct address_space *mapping,
> + pgoff_t index, fgf_t fgf_flags, gfp_t gfp)
> +{
> + return __filemap_get_folio_mpol(mapping, index, fgf_flags, gfp, NULL);
> +}
> +
> /**
> * filemap_get_folio - Find and get a folio.
> * @mapping: The address_space to search.
> diff --git a/mm/filemap.c b/mm/filemap.c
> index a26df313207d..597d146cbb3a 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1896,11 +1896,12 @@ void *filemap_get_entry(struct address_space *mapping, pgoff_t index)
> }
>
> /**
> - * __filemap_get_folio - Find and get a reference to a folio.
> + * __filemap_get_folio_mpol - Find and get a reference to a folio.
> * @mapping: The address_space to search.
> * @index: The page index.
> * @fgp_flags: %FGP flags modify how the folio is returned.
> * @gfp: Memory allocation flags to use if %FGP_CREAT is specified.
> + * @policy: NUMA memory allocation policy to follow.
> *
> * Looks up the page cache entry at @mapping & @index.
> *
> @@ -1911,8 +1912,9 @@ void *filemap_get_entry(struct address_space *mapping, pgoff_t index)
> *
> * Return: The found folio or an ERR_PTR() otherwise.
> */
> -struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
> - fgf_t fgp_flags, gfp_t gfp)
> +struct folio *__filemap_get_folio_mpol(struct address_space *mapping,
> + pgoff_t index, fgf_t fgp_flags, gfp_t gfp,
> + struct mempolicy *policy)
> {
> struct folio *folio;
>
> @@ -1982,7 +1984,7 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
> err = -ENOMEM;
> if (order > min_order)
> alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN;
> - folio = filemap_alloc_folio(alloc_gfp, order, NULL);
> + folio = filemap_alloc_folio(alloc_gfp, order, policy);
> if (!folio)
> continue;
>
Powered by blists - more mailing lists