[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200623124201.8199-2-richard.weiyang@linux.alibaba.com>
Date: Tue, 23 Jun 2020 20:41:59 +0800
From: Wei Yang <richard.weiyang@...ux.alibaba.com>
To: mgorman@...e.de, akpm@...ux-foundation.org,
richard.weiyang@...ux.alibaba.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] mm/page_alloc.c: extract the common part in pfn_to_bitidx()
The return value calculation is the same both for SPARSEMEM or not.
Just took it out.
Signed-off-by: Wei Yang <richard.weiyang@...ux.alibaba.com>
---
mm/page_alloc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 727751219003..efc2c355ac52 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -459,11 +459,10 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
{
#ifdef CONFIG_SPARSEMEM
pfn &= (PAGES_PER_SECTION-1);
- return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
#else
pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages);
- return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
#endif /* CONFIG_SPARSEMEM */
+ return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
}
/**
--
2.20.1 (Apple Git-117)
Powered by blists - more mailing lists