]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
mm/page_alloc.c: extract the common part in pfn_to_bitidx()
authorWei Yang <richard.weiyang@linux.alibaba.com>
Fri, 7 Aug 2020 06:25:44 +0000 (23:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 Aug 2020 18:33:29 +0000 (11:33 -0700)
The return value calculation is the same both for SPARSEMEM or not.

Just take it out.

Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Link: http://lkml.kernel.org/r/20200623124201.8199-2-richard.weiyang@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c

index ba09a3aeb76b0f80980eddef74fbdbcd16288ef0..6c524fb76b317aeeb98ad9f72573a50d1c693f20 100644 (file)
@@ -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;
 }
 
 /**