Skip to content

Commit

Permalink
memory-hotplug: remove redundant call of page_to_pfn
Browse files Browse the repository at this point in the history
This is just a small optimization.  The start_pfn can be obtained directly
by phys_index << PFN_SECTION_SHIFT.  So the call of page_to_pfn() is
redundant and remove it.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Zhang Zhen authored and Linus Torvalds committed Dec 13, 2014
1 parent 9dc00f4 commit 71fbd55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
struct page *first_page;
int ret;

first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT);
start_pfn = page_to_pfn(first_page);
start_pfn = phys_index << PFN_SECTION_SHIFT;
first_page = pfn_to_page(start_pfn);

switch (action) {
case MEM_ONLINE:
Expand Down

0 comments on commit 71fbd55

Please sign in to comment.