public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: Zi Yan <ziy@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>,
	Balbir Singh <balbirs@nvidia.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Jason Gunthorpe <jgg@nvidia.com>, Michal Hocko <mhocko@suse.com>,
	Jens Axboe <axboe@kernel.dk>,
	David Hildenbrand <david@kernel.org>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Barry Song <baohua@kernel.org>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	Brendan Jackman <jackmanb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	io-uring@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] io_uring: allocate folio in io_mem_alloc_compound() and function rename
Date: Sat, 31 Jan 2026 23:30:35 +0800	[thread overview]
Message-ID: <b37f990b-cb70-489b-849e-202eae190c37@linux.dev> (raw)
In-Reply-To: <20260130034818.472804-2-ziy@nvidia.com>



On 2026/1/30 11:48, Zi Yan wrote:
> The page allocated in io_mem_alloc_compound() is actually used as a folio
> later in io_region_mmap(). So allocate a folio instead of a compound page
> and rename io_mem_alloc_compound() to io_mem_alloc_folio().
> 
> This prepares for code separation of compound page and folio in a follow-up
> commit.
> 
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> ---
>   io_uring/memmap.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/io_uring/memmap.c b/io_uring/memmap.c
> index 7d3c5eb58480..8ed8a78d71cc 100644
> --- a/io_uring/memmap.c
> +++ b/io_uring/memmap.c
> @@ -15,10 +15,10 @@
>   #include "rsrc.h"
>   #include "zcrx.h"
>   
> -static bool io_mem_alloc_compound(struct page **pages, int nr_pages,
> +static bool io_mem_alloc_folio(struct page **pages, int nr_pages,
>   				  size_t size, gfp_t gfp)
>   {
> -	struct page *page;
> +	struct folio *folio;
>   	int i, order;
>   
>   	order = get_order(size);
> @@ -27,12 +27,12 @@ static bool io_mem_alloc_compound(struct page **pages, int nr_pages,

Nit:

>   	else if (order)
>   		gfp |= __GFP_COMP;

Since we're switching to folio_alloc(), which already adds __GFP_COMP
internally, the "else if (order)" part above can be dropped while at it.

IIUC, for order == 0, __GFP_COMP gets ignored anyway:

  - prep_new_page() won't call prep_compound_page() (since order is zero)
  - page_rmappable_folio() sees a non-compound page and does nothing

So no behavior change there :)

>   
> -	page = alloc_pages(gfp, order);
> -	if (!page)
> +	folio = folio_alloc(gfp, order);
> +	if (!folio)
>   		return false;
>   
>   	for (i = 0; i < nr_pages; i++)
> -		pages[i] = page + i;
> +		pages[i] = folio_page(folio, i);
>   
>   	return true;
>   }
> @@ -162,7 +162,7 @@ static int io_region_allocate_pages(struct io_mapped_region *mr,
>   	if (!pages)
>   		return -ENOMEM;
>   
> -	if (io_mem_alloc_compound(pages, mr->nr_pages, size, gfp)) {
> +	if (io_mem_alloc_folio(pages, mr->nr_pages, size, gfp)) {
>   		mr->flags |= IO_REGION_F_SINGLE_REF;
>   		goto done;
>   	}


  reply	other threads:[~2026-01-31 15:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  3:48 [RFC PATCH 0/5] Separate compound page from folio Zi Yan
2026-01-30  3:48 ` [RFC PATCH 1/5] io_uring: allocate folio in io_mem_alloc_compound() and function rename Zi Yan
2026-01-31 15:30   ` Lance Yang [this message]
2026-02-01  2:04     ` Zi Yan
2026-01-30  3:48 ` [RFC PATCH 2/5] mm/huge_memory: use page_rmappable_folio() to convert after-split folios Zi Yan
2026-01-30  3:48 ` [RFC PATCH 3/5] mm/hugetlb: set large_rmappable on hugetlb and avoid deferred_list handling Zi Yan
2026-01-30  3:48 ` [RFC PATCH 4/5] mm: only use struct page in compound_nr() and compound_order() Zi Yan
2026-01-30  3:48 ` [RFC PATCH 5/5] mm: code separation for compound page and folio Zi Yan
2026-01-30  8:15 ` [syzbot ci] Re: Separate compound page from folio syzbot ci
2026-01-30 16:39   ` [syzbot ci] " Zi Yan
2026-01-30 16:41     ` syzbot ci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b37f990b-cb70-489b-849e-202eae190c37@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=axboe@kernel.dk \
    --cc=balbirs@nvidia.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=io-uring@vger.kernel.org \
    --cc=jackmanb@google.com \
    --cc=jgg@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=npache@redhat.com \
    --cc=osalvador@suse.de \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox