mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Luiz Capitulino <luizcap@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	yuzhao@google.com, pasha.tatashin@soleen.com
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, muchun.song@linux.dev
Subject: Re: [PATCH v3 3/3] mm: page_owner: use new iteration API
Date: Fri, 7 Mar 2025 09:13:25 +0100	[thread overview]
Message-ID: <90c8183e-d5bb-4460-8c93-ab9bbe977d66@redhat.com> (raw)
In-Reply-To: <93c80b040960fa2ebab4a9729073f77a30649862.1741301089.git.luizcap@redhat.com>

On 06.03.25 23:44, Luiz Capitulino wrote:
> The page_ext_next() function assumes that page extension objects for a
> page order allocation always reside in the same memory section, which
> may not be true and could lead to crashes. Use the new page_ext
> iteration API instead.
> 
> Fixes: cf54f310d0d3 ("mm/hugetlb: use __GFP_COMP for gigantic folios")
> Signed-off-by: Luiz Capitulino <luizcap@redhat.com>
> ---
>   mm/page_owner.c | 84 +++++++++++++++++++++++--------------------------
>   1 file changed, 39 insertions(+), 45 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 2d6360eaccbb6..65adc66582d82 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -229,17 +229,19 @@ static void dec_stack_record_count(depot_stack_handle_t handle,
>   			handle);
>   }
>   
> -static inline void __update_page_owner_handle(struct page_ext *page_ext,
> +static inline void __update_page_owner_handle(struct page *page,
>   					      depot_stack_handle_t handle,
>   					      unsigned short order,
>   					      gfp_t gfp_mask,
>   					      short last_migrate_reason, u64 ts_nsec,
>   					      pid_t pid, pid_t tgid, char *comm)
>   {
> -	int i;
> +	struct page_ext_iter iter;
> +	struct page_ext *page_ext;
>   	struct page_owner *page_owner;
>   
> -	for (i = 0; i < (1 << order); i++) {
> +	rcu_read_lock();
> +	for_each_page_ext(page, 1 << order, page_ext, iter) {

I realize that we could get rid of all the temporary
page_ext variables and simply operate on iter.page_ext.

If that makes sense, it could be done as a cleanup on top later. Thanks 
Luiz!

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

-- 
Cheers,

David / dhildenb


      reply	other threads:[~2025-03-07  8:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 22:44 [PATCH v3 0/3] mm: page_ext: Introduce " Luiz Capitulino
2025-03-06 22:44 ` [PATCH v3 1/3] mm: page_ext: add an iteration API for page extensions Luiz Capitulino
2025-03-07  8:10   ` David Hildenbrand
2025-03-06 22:44 ` [PATCH v3 2/3] mm: page_table_check: use new iteration API Luiz Capitulino
2025-03-06 22:44 ` [PATCH v3 3/3] mm: page_owner: " Luiz Capitulino
2025-03-07  8:13   ` David Hildenbrand [this message]

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=90c8183e-d5bb-4460-8c93-ab9bbe977d66@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luizcap@redhat.com \
    --cc=muchun.song@linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=yuzhao@google.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

all inboxes | Powered by JetHome®