Re: [Patch v2 2/4] mm/migrate.c: wrap do_move_pages_to_node() and store_status()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 28, 2020 at 11:14:55AM +0100, David Hildenbrand wrote:
>On 22.01.20 02:16, Wei Yang wrote:
>> Usually do_move_pages_to_node() and store_status() is a pair. There are
>> three places call this pair of functions with almost the same form.
>
>I'd suggest
>
>"
>Usually, do_move_pages_to_node() and store_status() are used in
>combination. We have three similar call sites.
>
>Let's provide a wrapper for both function calls -
>move_pages_and_store_status - to make the calling code easier to
>maintain and fix (as noted by Yang Shi, the return value handling of
>do_move_pages_to_node() has a flaw).
>"

Looks good.

>
>> 
>> This patch just wrap it to make it friendly to audience and also
>> consolidate the move and store action into one place. Also mentioned by
>> Yang Shi, the handling of do_move_pages_to_node()'s return value is not
>> proper. Now we can fix it in one place.
>> 
>> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
>> Acked-by: Michal Hocko <mhocko@xxxxxxxx>
>> ---
>>  mm/migrate.c | 30 +++++++++++++++++++-----------
>>  1 file changed, 19 insertions(+), 11 deletions(-)
>> 
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 4c2a21856717..a4d3bd6475e1 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -1583,6 +1583,19 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
>>  	return err;
>>  }
>>  
>> +static int move_pages_and_store_status(struct mm_struct *mm, int node,
>> +		struct list_head *pagelist, int __user *status,
>> +		int start, int nr)
>
>nit: indentation
>

You mean indent like this?

static int move_pages_and_store_status(struct mm_struct *mm, int node,
				       struct list_head *pagelist,
				       int __user *status,

This would be along list and I am afraid this is not the only valid code
style?

>> +{
>> +	int err;
>> +
>> +	err = do_move_pages_to_node(mm, pagelist, node);
>> +	if (err)
>> +		return err;
>> +	err = store_status(status, start, node, nr);
>> +	return err;
>
>return store_status(status, start, node, nr);
>
>directly
>

ok

>
>
>Apart from that (and some more indentation nits)
>
>Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
>
>
>-- 
>Thanks,
>
>David / dhildenb

-- 
Wei Yang
Help you, Help me




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux