* [PATCH 0/2] Two minor cleanups for get pageblock migratetype @ 2023-08-11 11:59 Kemeng Shi 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi 2023-08-11 11:59 ` [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn Kemeng Shi 0 siblings, 2 replies; 8+ messages in thread From: Kemeng Shi @ 2023-08-11 11:59 UTC (permalink / raw) To: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david, willy Cc: shikemeng Hi all, this series contains two minor cleanups for get pageblock migratetype. More details can be found in respective pages. Thanks! Kemeng Shi (2): mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn mm/page_alloc.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) -- 2.30.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask 2023-08-11 11:59 [PATCH 0/2] Two minor cleanups for get pageblock migratetype Kemeng Shi @ 2023-08-11 11:59 ` Kemeng Shi 2023-08-11 4:28 ` Matthew Wilcox ` (2 more replies) 2023-08-11 11:59 ` [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn Kemeng Shi 1 sibling, 3 replies; 8+ messages in thread From: Kemeng Shi @ 2023-08-11 11:59 UTC (permalink / raw) To: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david, willy Cc: shikemeng 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 <shikemeng@huaweicloud.com> --- 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi @ 2023-08-11 4:28 ` Matthew Wilcox 2023-08-21 12:20 ` Mel Gorman 2023-08-21 21:23 ` Johannes Weiner 2 siblings, 0 replies; 8+ messages in thread From: Matthew Wilcox @ 2023-08-11 4:28 UTC (permalink / raw) To: Kemeng Shi; +Cc: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david 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 <shikemeng@huaweicloud.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> This could have happened at any time after 535b81e20921 (and arguably should have happened as part of it) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi 2023-08-11 4:28 ` Matthew Wilcox @ 2023-08-21 12:20 ` Mel Gorman 2023-08-21 21:23 ` Johannes Weiner 2 siblings, 0 replies; 8+ messages in thread From: Mel Gorman @ 2023-08-21 12:20 UTC (permalink / raw) To: Kemeng Shi; +Cc: linux-mm, linux-kernel, akpm, baolin.wang, david, willy 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 <shikemeng@huaweicloud.com> Acked-by: Mel Gorman <mgorman@techsingularity.net> -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi 2023-08-11 4:28 ` Matthew Wilcox 2023-08-21 12:20 ` Mel Gorman @ 2023-08-21 21:23 ` Johannes Weiner 2 siblings, 0 replies; 8+ messages in thread From: Johannes Weiner @ 2023-08-21 21:23 UTC (permalink / raw) To: Kemeng Shi Cc: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david, willy 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 <shikemeng@huaweicloud.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn 2023-08-11 11:59 [PATCH 0/2] Two minor cleanups for get pageblock migratetype Kemeng Shi 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi @ 2023-08-11 11:59 ` Kemeng Shi 2023-08-21 12:21 ` Mel Gorman 2023-08-21 21:24 ` Johannes Weiner 1 sibling, 2 replies; 8+ messages in thread From: Kemeng Shi @ 2023-08-11 11:59 UTC (permalink / raw) To: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david, willy Cc: shikemeng We have get_pageblock_migratetype and get_pfnblock_migratetype to get migratetype of page. get_pfnblock_migratetype accepts both page and pfn from caller while get_pageblock_migratetype only accept page and get pfn with page_to_pfn from page. In case we already record pfn of page, we can simply call get_pfnblock_migratetype to avoid a page_to_pfn. Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6c2294ccc6cb..56db21666611 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -813,7 +813,7 @@ static inline void __free_one_page(struct page *page, * pageblock isolation could cause incorrect freepage or CMA * accounting or HIGHATOMIC accounting. */ - int buddy_mt = get_pageblock_migratetype(buddy); + int buddy_mt = get_pfnblock_migratetype(buddy, buddy_pfn); if (migratetype != buddy_mt && (!migratetype_is_mergeable(migratetype) || @@ -889,7 +889,7 @@ int split_free_page(struct page *free_page, goto out; } - mt = get_pageblock_migratetype(free_page); + mt = get_pfnblock_migratetype(free_page, free_page_pfn); if (likely(!is_migrate_isolate(mt))) __mod_zone_freepage_state(zone, -(1UL << order), mt); -- 2.30.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn 2023-08-11 11:59 ` [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn Kemeng Shi @ 2023-08-21 12:21 ` Mel Gorman 2023-08-21 21:24 ` Johannes Weiner 1 sibling, 0 replies; 8+ messages in thread From: Mel Gorman @ 2023-08-21 12:21 UTC (permalink / raw) To: Kemeng Shi; +Cc: linux-mm, linux-kernel, akpm, baolin.wang, david, willy On Fri, Aug 11, 2023 at 07:59:45PM +0800, Kemeng Shi wrote: > We have get_pageblock_migratetype and get_pfnblock_migratetype to get > migratetype of page. get_pfnblock_migratetype accepts both page and pfn > from caller while get_pageblock_migratetype only accept page and get pfn > with page_to_pfn from page. > In case we already record pfn of page, we can simply call > get_pfnblock_migratetype to avoid a page_to_pfn. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Acked-by: Mel Gorman <mgorman@techsingularity.net> -- Mel Gorman SUSE Labs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn 2023-08-11 11:59 ` [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn Kemeng Shi 2023-08-21 12:21 ` Mel Gorman @ 2023-08-21 21:24 ` Johannes Weiner 1 sibling, 0 replies; 8+ messages in thread From: Johannes Weiner @ 2023-08-21 21:24 UTC (permalink / raw) To: Kemeng Shi Cc: linux-mm, linux-kernel, akpm, baolin.wang, mgorman, david, willy On Fri, Aug 11, 2023 at 07:59:45PM +0800, Kemeng Shi wrote: > We have get_pageblock_migratetype and get_pfnblock_migratetype to get > migratetype of page. get_pfnblock_migratetype accepts both page and pfn > from caller while get_pageblock_migratetype only accept page and get pfn > with page_to_pfn from page. > In case we already record pfn of page, we can simply call > get_pfnblock_migratetype to avoid a page_to_pfn. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-08-21 21:24 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-11 11:59 [PATCH 0/2] Two minor cleanups for get pageblock migratetype Kemeng Shi 2023-08-11 11:59 ` [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Kemeng Shi 2023-08-11 4:28 ` Matthew Wilcox 2023-08-21 12:20 ` Mel Gorman 2023-08-21 21:23 ` Johannes Weiner 2023-08-11 11:59 ` [PATCH 2/2] mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn Kemeng Shi 2023-08-21 12:21 ` Mel Gorman 2023-08-21 21:24 ` Johannes Weiner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.