From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] mmzone: Introduce folio_migratetype()
Date: Wed, 14 Jun 2023 21:17:34 +0100 [thread overview]
Message-ID: <ZIogXmFNr3MnBtjX@casper.infradead.org> (raw)
In-Reply-To: <20230614131305.2939f29e4372c94a8c6a56a8@linux-foundation.org>
On Wed, Jun 14, 2023 at 01:13:05PM -0700, Andrew Morton wrote:
> On Tue, 13 Jun 2023 19:13:09 -0700 "Vishal Moola (Oracle)" <vishal.moola@gmail.com> wrote:
>
> > Introduce folio_migratetype() as a folio equivalent for
> > get_pageblock_migratetype(). This function intends to return the
> > migratetype the folio is located in, hence the name choice.
> >
> > ...
> >
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -105,6 +105,9 @@ extern int page_group_by_mobility_disabled;
> > #define get_pageblock_migratetype(page) \
> > get_pfnblock_flags_mask(page, page_to_pfn(page), MIGRATETYPE_MASK)
> >
> > +#define folio_migratetype(folio) \
> > + get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \
> > + MIGRATETYPE_MASK)
>
> Theoretically this is risky because it evaluates its argument more than
> once. Although folio_migratetype(folio++) seems an unlikely thing to do.
folio++ is always an unsafe thing to do. folios are not consecutive
in memory (unless we know they're order-0).
> An inlined C function is always preferable. My quick attempt at that
> reveals that the header files are All Messed Up As Usual.
The page-equivalent of this also evaluates its arguments more than once,
so it doesn't see too risky for now?
next prev parent reply other threads:[~2023-06-14 20:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 2:13 [PATCH v2 0/5] Replace is_longterm_pinnable_page() Vishal Moola (Oracle)
2023-06-14 2:13 ` [PATCH v2 1/5] mmzone: Introduce folio_is_zone_movable() Vishal Moola (Oracle)
2023-06-14 2:13 ` [PATCH v2 2/5] mmzone: Introduce folio_migratetype() Vishal Moola (Oracle)
2023-06-14 20:13 ` Andrew Morton
2023-06-14 20:17 ` Matthew Wilcox [this message]
2023-06-14 20:33 ` Andrew Morton
2023-06-14 2:13 ` [PATCH v2 3/5] mm/gup_test.c: Convert verify_dma_pinned() to us folios Vishal Moola (Oracle)
2023-06-14 2:13 ` [PATCH v2 4/5] mm/gup.c: Reorganize try_get_folio() Vishal Moola (Oracle)
2023-06-14 2:13 ` [PATCH v2 5/5] mm: Remove is_longterm_pinnable_page() and Reimplement folio_is_longterm_pinnable() Vishal Moola (Oracle)
2023-06-17 20:50 ` Lorenzo Stoakes
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=ZIogXmFNr3MnBtjX@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vishal.moola@gmail.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