OSDN Git Service

mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn
authorKemeng Shi <shikemeng@huaweicloud.com>
Fri, 11 Aug 2023 11:59:45 +0000 (19:59 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 21 Aug 2023 20:37:51 +0000 (13:37 -0700)
commitb5ffd2973365298c4d829802653133038837a6f9
treef4ea2e0caa17da19faa35ca7a87b3d131d65d02b
parenta04d12c2481fbf2752b5686d8a8049dd59e61e37
mm/page_alloc: use get_pfnblock_migratetype to avoid extra page_to_pfn

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.

Link: https://lkml.kernel.org/r/20230811115945.3423894-3-shikemeng@huaweicloud.com
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c