lkml.org 
[lkml]   [2020]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mm : fix pte _PAGE_DIRTY bit when fallback migrate page
From
Date

Kirill A. Shutemov 於 2020/7/14 下午6:19 寫道:
> On Tue, Jul 14, 2020 at 11:46:12AM +0200, Vlastimil Babka wrote:
>> On 7/13/20 3:57 AM, Robbie Ko wrote:
>>> Vlastimil Babka 於 2020/7/10 下午11:31 寫道:
>>>> On 7/9/20 4:48 AM, robbieko wrote:
>>>>> From: Robbie Ko <robbieko@synology.com>
>>>>>
>>>>> When a migrate page occurs, we first create a migration entry
>>>>> to replace the original pte, and then go to fallback_migrate_page
>>>>> to execute a writeout if the migratepage is not supported.
>>>>>
>>>>> In the writeout, we will clear the dirty bit of the page and use
>>>>> page_mkclean to clear the dirty bit along with the corresponding pte,
>>>>> but page_mkclean does not support migration entry.
> I don't follow the scenario.
>
> When we establish migration entries with try_to_unmap(), it transfers
> dirty bit from PTE to the page.

Sorry, I mean is _PAGE_RW with pte_write

When we establish migration entries with try_to_unmap(),
we create a migration entry, and if pte_write we set it to SWP_MIGRATION_WRITE,
which will replace the migration entry with the original pte.

When migratepage, we go to fallback_migrate_page to execute a writeout
if the migratepage is not supported.

In the writeout, we call clear_page_dirty_for_io to clear the dirty bit of the page
and use page_mkclean to clear pte _PAGE_RW with pte_wrprotect in page_mkclean_one.

However, page_mkclean_one does not support migration entries, so the
migration entry is still SWP_MIGRATION_WRITE.

In writeout, then we call remove_migration_ptes to remove the migration entry,
because it is still SWP_MIGRATION_WRITE so set _PAGE_RW to pte via pte_mkwrite.

Therefore, subsequent mmap wirte will not trigger page_mkwrite to cause data loss.


\
 
 \ /
  Last update: 2020-07-15 04:46    [W:0.077 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site