diff mbox series

[1/8] mm: page_alloc: use get_pfnblock_migratetype where pfn available

Message ID 20230821183733.106619-2-hannes@cmpxchg.org (mailing list archive)
State New
Headers show
Series mm: page_alloc: freelist migratetype hygiene | expand

Commit Message

Johannes Weiner Aug. 21, 2023, 6:33 p.m. UTC
Save a pfn_to_page() lookup when the pfn is right there already.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Zi Yan Aug. 21, 2023, 8:14 p.m. UTC | #1
On 21 Aug 2023, at 14:33, Johannes Weiner wrote:

> Save a pfn_to_page() lookup when the pfn is right there already.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/page_alloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi
Zi Yan Aug. 21, 2023, 8:29 p.m. UTC | #2
On 21 Aug 2023, at 14:33, Johannes Weiner wrote:

> Save a pfn_to_page() lookup when the pfn is right there already.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/page_alloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Just notice that it is already done in:
https://lkml.kernel.org/r/20230811115945.3423894-3-shikemeng@huaweicloud.com

--
Best Regards,
Yan, Zi
Johannes Weiner Aug. 21, 2023, 9:22 p.m. UTC | #3
On Mon, Aug 21, 2023 at 04:29:36PM -0400, Zi Yan wrote:
> On 21 Aug 2023, at 14:33, Johannes Weiner wrote:
> 
> > Save a pfn_to_page() lookup when the pfn is right there already.
> >
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> > ---
> >  mm/page_alloc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Just notice that it is already done in:
> https://lkml.kernel.org/r/20230811115945.3423894-3-shikemeng@huaweicloud.com

Even better :) I'll rebase on top of this.
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 977bb4d5e8e1..e430ac45df7c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -824,7 +824,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) ||
@@ -900,7 +900,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);