[2/4] mm/page_alloc.c: extract the common part in pfn_to_bitidx()
diff mbox series

Message ID 20200623124201.8199-2-richard.weiyang@linux.alibaba.com
State New
Headers show
Series
  • [1/4] mm/page_alloc.c: replace the definition of NR_MIGRATETYPE_BITS with PB_migratetype_bits
Related show

Commit Message

Wei Yang June 23, 2020, 12:41 p.m. UTC
The return value calculation is the same both for SPARSEMEM or not.

Just took it out.

Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch
diff mbox series

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;
 }
 
 /**