2014-11-11 09:13:54

by Zhang Zhen

[permalink] [raw]
Subject: [PATCH] memory-hotplug: remove redundant call of page_to_pfn

The start_pfn can be obtained directly by
phys_index << PFN_SECTION_SHIFT.

Signed-off-by: Zhang Zhen <[email protected]>
---
drivers/base/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 7c5d871..85be040 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -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:
--
1.8.1.4


.




2014-11-12 03:16:58

by Yasuaki Ishimatsu

[permalink] [raw]
Subject: Re: [PATCH] memory-hotplug: remove redundant call of page_to_pfn

(2014/11/11 18:13), Zhang Zhen wrote:
> The start_pfn can be obtained directly by
> phys_index << PFN_SECTION_SHIFT.
>
> Signed-off-by: Zhang Zhen <[email protected]>
> ---

The patch looks good to me but I want you to write a purpose of the patch
to the description for other reviewer.

Thanks,
Yasuaki Ishimatsu

> drivers/base/memory.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 7c5d871..85be040 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -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:
>

2014-11-12 03:42:42

by Zhang Zhen

[permalink] [raw]
Subject: Re: [PATCH] memory-hotplug: remove redundant call of page_to_pfn

On 2014/11/12 11:16, Yasuaki Ishimatsu wrote:
> (2014/11/11 18:13), Zhang Zhen wrote:
>> The start_pfn can be obtained directly by
>> phys_index << PFN_SECTION_SHIFT.
>>
>> Signed-off-by: Zhang Zhen <[email protected]>
>> ---
>
> The patch looks good to me but I want you to write a purpose of the patch
> to the description for other reviewer.
>
> Thanks,
> Yasuaki Ishimatsu
>

Ok, thanks for your review.

>> drivers/base/memory.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
>> index 7c5d871..85be040 100644
>> --- a/drivers/base/memory.c
>> +++ b/drivers/base/memory.c
>> @@ -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:
>>
>
>
>
>

2014-11-17 19:45:08

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] memory-hotplug: remove redundant call of page_to_pfn

On Tue, 11 Nov 2014, Zhang Zhen wrote:

> The start_pfn can be obtained directly by
> phys_index << PFN_SECTION_SHIFT.
>
> Signed-off-by: Zhang Zhen <[email protected]>

Acked-by: David Rientjes <[email protected]>