Re: [HELP-NEEDED, PATCH 0/3] Do not loose dirty bit on THP pages

From: Aneesh Kumar K.V
Date: Thu Jun 15 2017 - 05:37:19 EST




On Thursday 15 June 2017 02:18 PM, Kirill A. Shutemov wrote:
O
I am not suggesting we don't do the invalidate (the need for that is
documented in __split_huge_pmd_locked(). I am suggesting we need a new
interface, something like Andrea suggested.

old_pmd = pmdp_establish(pmd_mknotpresent());

instead of pmdp_invalidate(). We can then use this in scenarios where we
want to update pmd PTE entries, where right now we go through a pmdp_clear
and set_pmd path. We should really not do that for THP entries.

Which cases are you talking about? When do we need to clear pmd and set
later?


With the latest upstream I am finding the usage when we mark pte clean page_mkclean_one . Also there is a similar usage in migrate_misplaced_transhuge_page(). I haven't really verified whether they do cause any race. But my suggestion is, we should avoid the usage of set_pmd_at() unless we are creating a new pmd PTE entry. If we can provide pmdp_establish() we can achieve that easily.

-aneesh