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 <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>
This commit is contained in:
parent
d38ac97f8a
commit
399b795b7a
@ -459,11 +459,10 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn)
|
|||||||
{
|
{
|
||||||
#ifdef CONFIG_SPARSEMEM
|
#ifdef CONFIG_SPARSEMEM
|
||||||
pfn &= (PAGES_PER_SECTION-1);
|
pfn &= (PAGES_PER_SECTION-1);
|
||||||
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
|
|
||||||
#else
|
#else
|
||||||
pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages);
|
pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages);
|
||||||
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
|
|
||||||
#endif /* CONFIG_SPARSEMEM */
|
#endif /* CONFIG_SPARSEMEM */
|
||||||
|
return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user