linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH v3 13/15] mm/page_alloc: Add __alloc_frozen_pages()
Date: Fri, 29 Nov 2024 15:36:01 +0100	[thread overview]
Message-ID: <d67eecaf-05e5-42a4-bfae-b93bb5dc81ee@redhat.com> (raw)
In-Reply-To: <20241125210149.2976098-14-willy@infradead.org>

On 25.11.24 22:01, Matthew Wilcox (Oracle) wrote:
> Defer the initialisation of the page refcount to the new __alloc_pages()
> wrapper and turn the old __alloc_pages() into __alloc_frozen_pages().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/internal.h   |  4 ++++
>   mm/page_alloc.c | 18 ++++++++++++++----
>   2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/internal.h b/mm/internal.h
> index 9cc5fdc614cf..55e03f8f41d9 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -740,6 +740,10 @@ extern bool free_pages_prepare(struct page *page, unsigned int order);
>   
>   extern int user_min_free_kbytes;
>   
> +struct page *__alloc_frozen_pages_noprof(gfp_t, unsigned int order, int nid,
> +		nodemask_t *);
> +#define __alloc_frozen_pages(...) \
> +	alloc_hooks(__alloc_frozen_pages_noprof(__VA_ARGS__))
>   void free_frozen_pages(struct page *page, unsigned int order);
>   void free_unref_folios(struct folio_batch *fbatch);
>   
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 35fb45b8b369..67b1cb757def 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4747,8 +4747,8 @@ EXPORT_SYMBOL_GPL(alloc_pages_bulk_noprof);
>   /*
>    * This is the 'heart' of the zoned buddy allocator.
>    */
> -struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order,
> -				      int preferred_nid, nodemask_t *nodemask)
> +struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
> +		int preferred_nid, nodemask_t *nodemask)
>   {
>   	struct page *page;
>   	unsigned int alloc_flags = ALLOC_WMARK_LOW;
> @@ -4804,14 +4804,24 @@ struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order,
>   		free_frozen_pages(page, order);
>   		page = NULL;
>   	}
> -	if (page)
> -		set_page_refcounted(page);
>   
>   	trace_mm_page_alloc(page, order, alloc_gfp, ac.migratetype);
>   	kmsan_alloc_page(page, order, alloc_gfp);
>   
>   	return page;
>   }
> +EXPORT_SYMBOL(__alloc_frozen_pages_noprof);
> +
> +struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order,
> +		int preferred_nid, nodemask_t *nodemask)
> +{
> +	struct page *page;
> +
> +	page = __alloc_frozen_pages_noprof(gfp, order, preferred_nid, nodemask);
> +	if (page)
> +		set_page_refcounted(page);
> +	return page;
> +}
>   EXPORT_SYMBOL(__alloc_pages_noprof);
>   
>   struct folio *__folio_alloc_noprof(gfp_t gfp, unsigned int order, int preferred_nid,


Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-11-29 14:36 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 21:01 [PATCH v3 00/15] Allocate and free frozen pages Matthew Wilcox (Oracle)
2024-11-25 21:01 ` [PATCH v3 01/15] mm/page_alloc: Cache page_zone() result in free_unref_page() Matthew Wilcox (Oracle)
2024-11-29 14:30   ` David Hildenbrand
2024-11-29 15:37   ` Zi Yan
2024-12-03 16:53   ` Vlastimil Babka
2024-12-03 16:54   ` Vlastimil Babka
2024-12-03 17:20     ` Matthew Wilcox
2024-12-03 18:38       ` Konstantin Ryabitsev
2024-11-25 21:01 ` [PATCH v3 02/15] mm: Make alloc_pages_mpol() static Matthew Wilcox (Oracle)
2024-11-29 14:31   ` David Hildenbrand
2024-11-29 15:42   ` Zi Yan
2024-12-03 16:58   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 03/15] mm/page_alloc: Export free_frozen_pages() instead of free_unref_page() Matthew Wilcox (Oracle)
2024-11-29 15:47   ` Zi Yan
2024-12-04  9:37   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 04/15] mm/page_alloc: Move set_page_refcounted() to callers of post_alloc_hook() Matthew Wilcox (Oracle)
2024-11-29 14:31   ` David Hildenbrand
2024-11-29 15:51   ` Zi Yan
2024-12-04  9:46   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 05/15] mm/page_alloc: Move set_page_refcounted() to callers of prep_new_page() Matthew Wilcox (Oracle)
2024-11-29 14:34   ` David Hildenbrand
2024-11-29 15:52   ` Zi Yan
2024-12-04  9:55   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 06/15] mm/page_alloc: Move set_page_refcounted() to callers of get_page_from_freelist() Matthew Wilcox (Oracle)
2024-11-29 15:55   ` Zi Yan
2024-12-04 10:03   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 07/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_cpuset_fallback() Matthew Wilcox (Oracle)
2024-11-29 15:58   ` Zi Yan
2024-12-04 10:36   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 08/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_may_oom() Matthew Wilcox (Oracle)
2024-11-29 16:01   ` Zi Yan
2024-12-04 10:37   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 09/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_compact() Matthew Wilcox (Oracle)
2024-11-29 16:06   ` Zi Yan
2024-12-04 10:39   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 10/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_direct_reclaim() Matthew Wilcox (Oracle)
2024-11-29 16:08   ` Zi Yan
2024-12-04 10:41   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 11/15] mm/page_alloc: Move set_page_refcounted() to callers of __alloc_pages_slowpath() Matthew Wilcox (Oracle)
2024-11-29 16:10   ` Zi Yan
2024-12-04 10:57   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 12/15] mm/page_alloc: Move set_page_refcounted() to end of __alloc_pages() Matthew Wilcox (Oracle)
2024-11-29 16:14   ` Zi Yan
2024-12-04 11:03   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 13/15] mm/page_alloc: Add __alloc_frozen_pages() Matthew Wilcox (Oracle)
2024-11-29 14:36   ` David Hildenbrand [this message]
2024-11-29 16:19   ` Zi Yan
2024-12-04 11:10   ` Vlastimil Babka
2025-01-13  3:29     ` Andrew Morton
2024-11-25 21:01 ` [PATCH v3 14/15] mm/mempolicy: Add alloc_frozen_pages() Matthew Wilcox (Oracle)
2024-11-29 14:44   ` David Hildenbrand
2024-11-29 16:29     ` Zi Yan
2024-11-29 17:18       ` David Hildenbrand
2024-12-04 11:34         ` Vlastimil Babka
2024-12-04 13:58           ` David Hildenbrand
2024-12-04 11:29   ` Vlastimil Babka
2024-11-25 21:01 ` [PATCH v3 15/15] slab: Allocate frozen pages Matthew Wilcox (Oracle)
2024-11-27 15:07   ` David Hildenbrand
2024-11-27 15:52     ` Matthew Wilcox
2024-12-04 14:43       ` Vlastimil Babka
2025-01-13  9:18         ` Vlastimil Babka
2024-11-26  5:04 ` [PATCH v3 00/15] Allocate and free " Hyeonggon Yoo
2024-12-04 16:07   ` Vlastimil Babka
2024-12-09  0:17     ` Hyeonggon Yoo

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=d67eecaf-05e5-42a4-bfae-b93bb5dc81ee@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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