Skip to content

Commit 399b795

Browse files
weiyang-linuxtorvalds
authored andcommitted
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 take it out. Signed-off-by: Wei Yang <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Mel Gorman <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent d38ac97 commit 399b795

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mm/page_alloc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,10 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
459459
{
460460
#ifdef CONFIG_SPARSEMEM
461461
pfn &= (PAGES_PER_SECTION-1);
462-
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
463462
#else
464463
pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages);
465-
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
466464
#endif /* CONFIG_SPARSEMEM */
465+
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
467466
}
468467

469468
/**

0 commit comments

Comments
 (0)