lkml.org 
[lkml]   [2022]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC 2/6] mm/migrate_pages: split unmap_and_move() to _unmap() and _move()
Date
Zi Yan <ziy@nvidia.com> writes:

> On 21 Sep 2022, at 2:06, Huang Ying wrote:
>
>> This is a preparation patch to batch the page unmapping and moving
>> for the normal pages and THP.
>>
>> In this patch, unmap_and_move() is split to migrate_page_unmap() and
>> migrate_page_move(). So, we can batch _unmap() and _move() in
>> different loops later. To pass some information between unmap and
>> move, the original unused newpage->mapping and newpage->private are
>> used.
>>
>> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
>> Cc: Zi Yan <ziy@nvidia.com>
>> Cc: Yang Shi <shy828301@gmail.com>
>> Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
>> Cc: Oscar Salvador <osalvador@suse.de>
>> Cc: Matthew Wilcox <willy@infradead.org>
>> ---
>> mm/migrate.c | 164 ++++++++++++++++++++++++++++++++++++++-------------
>> 1 file changed, 122 insertions(+), 42 deletions(-)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index 117134f1c6dc..4a81e0bfdbcd 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -976,13 +976,32 @@ static int move_to_new_folio(struct folio *dst, struct folio *src,
>> return rc;
>> }
>>
>> -static int __unmap_and_move(struct page *page, struct page *newpage,
>> +static void __migrate_page_record(struct page *newpage,
>> + int page_was_mapped,
>> + struct anon_vma *anon_vma)
>> +{
>> + newpage->mapping = (struct address_space *)anon_vma;
>> + newpage->private = page_was_mapped;
>> +}
>> +
>> +static void __migrate_page_extract(struct page *newpage,
>> + int *page_was_mappedp,
>> + struct anon_vma **anon_vmap)
>> +{
>> + *anon_vmap = (struct anon_vma *)newpage->mapping;
>> + *page_was_mappedp = newpage->private;
>> + newpage->mapping = NULL;
>> + newpage->private = 0;
>> +}
>> +
>> +#define MIGRATEPAGE_UNMAP 1
>
> It is better to move this to migrate.h with MIGRATEPAGE_SUCCESS and
> make them an enum.

Make sense! Will do this in the next version.

Best Regards,
Huang, Ying

\
 
 \ /
  Last update: 2022-09-22 03:17    [W:0.172 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site