Skip to content

Commit

Permalink
mm/page_alloc.c: extract the common part in pfn_to_bitidx()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
weiyang-linux authored and torvalds committed Aug 7, 2020
1 parent d38ac97 commit 399b795
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 399b795

Please sign in to comment.