lkml.org 
[lkml]   [2019]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 01/31] mm: migrate: Add exchange_pages to exchange two lists of pages.
Date
On 21 Feb 2019, at 13:10, Jerome Glisse wrote:

> On Fri, Feb 15, 2019 at 02:08:26PM -0800, Zi Yan wrote:
>> From: Zi Yan <ziy@nvidia.com>
>>
>> In stead of using two migrate_pages(), a single exchange_pages() would
>> be sufficient and without allocating new pages.
>
> So i believe it would be better to arrange the code differently instead
> of having one function that special case combination, define function for
> each one ie:
> exchange_anon_to_share()
> exchange_anon_to_anon()
> exchange_share_to_share()
>
> Then you could define function to test if a page is in correct states:
> can_exchange_anon_page() // return true if page can be exchange
> can_exchange_share_page()
>
> In fact both of this function can be factor out as common helpers with the
> existing migrate code within migrate.c This way we would have one place
> only where we need to handle all the special casing, test and exceptions.
>
> Other than that i could not spot anything obviously wrong but i did not
> spent enough time to check everything. Re-architecturing the code like
> i propose above would make this a lot easier to review i believe.
>

Thank you for reviewing the patch. Your suggestions are very helpful.
I will restructure the code to help people review it.


>> + from_page_count = page_count(from_page);
>> + from_map_count = page_mapcount(from_page);
>> + to_page_count = page_count(to_page);
>> + to_map_count = page_mapcount(to_page);
>> + from_flags = from_page->flags;
>> + to_flags = to_page->flags;
>> + from_mapping = from_page->mapping;
>> + to_mapping = to_page->mapping;
>> + from_index = from_page->index;
>> + to_index = to_page->index;
>
> Those are not use anywhere ...

Will remove them. Thanks.

--
Best Regards,
Yan Zi

\
 
 \ /
  Last update: 2019-02-21 22:25    [W:0.098 / U:2.256 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site