2023-08-11 04:24:47

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask

Function get_pfnblock_flags_mask just calls inline inner
__get_pfnblock_flags_mask without any extra work. Just opencode
__get_pfnblock_flags_mask in get_pfnblock_flags_mask and replace call
to __get_pfnblock_flags_mask with call to get_pfnblock_flags_mask to
remove unnecessary __get_pfnblock_flags_mask.

Signed-off-by: Kemeng Shi <[email protected]>
---
mm/page_alloc.c | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e884d3fd0d06..6c2294ccc6cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -371,10 +371,16 @@ static inline int pfn_to_bitidx(const struct page *page, unsigned long pfn)
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
}

-static __always_inline
-unsigned long __get_pfnblock_flags_mask(const struct page *page,
- unsigned long pfn,
- unsigned long mask)
+/**
+ * get_pfnblock_flags_mask - Return the requested group of flags for the pageblock_nr_pages block of pages
+ * @page: The page within the block of interest
+ * @pfn: The target page frame number
+ * @mask: mask of bits that the caller is interested in
+ *
+ * Return: pageblock_bits flags
+ */
+unsigned long get_pfnblock_flags_mask(const struct page *page,
+ unsigned long pfn, unsigned long mask)
{
unsigned long *bitmap;
unsigned long bitidx, word_bitidx;
@@ -393,24 +399,10 @@ unsigned long __get_pfnblock_flags_mask(const struct page *page,
return (word >> bitidx) & mask;
}

-/**
- * get_pfnblock_flags_mask - Return the requested group of flags for the pageblock_nr_pages block of pages
- * @page: The page within the block of interest
- * @pfn: The target page frame number
- * @mask: mask of bits that the caller is interested in
- *
- * Return: pageblock_bits flags
- */
-unsigned long get_pfnblock_flags_mask(const struct page *page,
- unsigned long pfn, unsigned long mask)
-{
- return __get_pfnblock_flags_mask(page, pfn, mask);
-}
-
static __always_inline int get_pfnblock_migratetype(const struct page *page,
unsigned long pfn)
{
- return __get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK);
+ return get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK);
}

/**
--
2.30.0



2023-08-11 05:34:06

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask

On Fri, Aug 11, 2023 at 07:59:44PM +0800, Kemeng Shi wrote:
> Function get_pfnblock_flags_mask just calls inline inner
> __get_pfnblock_flags_mask without any extra work. Just opencode
> __get_pfnblock_flags_mask in get_pfnblock_flags_mask and replace call
> to __get_pfnblock_flags_mask with call to get_pfnblock_flags_mask to
> remove unnecessary __get_pfnblock_flags_mask.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>

This could have happened at any time after 535b81e20921 (and arguably
should have happened as part of it)

2023-08-21 14:17:45

by Mel Gorman

[permalink] [raw]
Subject: Re: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask

On Fri, Aug 11, 2023 at 07:59:44PM +0800, Kemeng Shi wrote:
> Function get_pfnblock_flags_mask just calls inline inner
> __get_pfnblock_flags_mask without any extra work. Just opencode
> __get_pfnblock_flags_mask in get_pfnblock_flags_mask and replace call
> to __get_pfnblock_flags_mask with call to get_pfnblock_flags_mask to
> remove unnecessary __get_pfnblock_flags_mask.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Acked-by: Mel Gorman <[email protected]>

--
Mel Gorman
SUSE Labs