mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, vishal.moola@oracle.com,
	muchun.song@linux.dev, peterx@redhat.com, osalvador@suse.de
Subject: Re: [PATCH] mm/hugetlb: remove {Set,Clear}Hpage macros
Date: Tue, 21 May 2024 01:40:26 +0100	[thread overview]
Message-ID: <ZkvteqofTbUK2XAu@casper.infradead.org> (raw)
In-Reply-To: <26e49614-ddb5-4d4c-97c1-a3a8c06d5bb5@oracle.com>

On Mon, May 20, 2024 at 04:44:53PM -0700, Sidhartha Kumar wrote:
> On 5/20/24 4:30 PM, Matthew Wilcox wrote:
> > On Mon, May 20, 2024 at 03:44:07PM -0700, Sidhartha Kumar wrote:
> > > All users have been converted to use the folio version of these macros,
> > > we can safely remove the page based interface.
> > 
> > Yay!
> > 
> > Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> 
> There is only one remaining user of page-based Test version of these macros.
> 
> in mm/memory-hotplug.c:
> 
> 		if (!PageHuge(page))
> 			continue;
> 		head = compound_head(page);
> 		/*
> 		 * This test is racy as we hold no reference or lock.  The
> 		 * hugetlb page could have been free'ed and head is no longer
> 		 * a hugetlb page before the following check.  In such unlikely
> 		 * cases false positives and negatives are possible.  Calling
> 		 * code must deal with these scenarios.
> 		 */
> 		if (HPageMigratable(head))
> 			goto found;
> 		skip = compound_nr(head) - (pfn - page_to_pfn(head));
> 
> 
> I've previously sent a patch to convert this to folios[1] but got feedback
> that it was unsafe. But I'm not sure why replacing compound_head() with
> page_folio() and using folio_test_hugetlb_migratable(folio) rather than
> HPageMigratable(head) changes the existing behavior. With no reference or
> lock, can't the head pointer also be moved and no longer be a part of page
> like the comment states. So would the folio conversion just be maintaining
> this level of existing un-safety that the calling code should handle
> anyways?

To be fair, that wasn't the last thing I said about that ...

https://lore.kernel.org/lkml/Y89DK23hYiLtgGNk@casper.infradead.org/

and looked like David agreed that this was a case where false
postive/negative was fine; we were just looking to be right most of
the time.

  reply	other threads:[~2024-05-21  0:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 22:44 Sidhartha Kumar
2024-05-20 23:30 ` Matthew Wilcox
2024-05-20 23:44   ` Sidhartha Kumar
2024-05-21  0:40     ` Matthew Wilcox [this message]
2024-05-21 10:00 ` David Hildenbrand
2024-05-21 10:51 ` Oscar Salvador

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=ZkvteqofTbUK2XAu@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=sidhartha.kumar@oracle.com \
    --cc=vishal.moola@oracle.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®