LoongArch: Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite()
Set _PAGE_DIRTY only if _PAGE_MODIFIED is set in {pmd,pte}_mkwrite(). Otherwise, _PAGE_DIRTY silences the TLB modify exception and make us have no chance to mark a pmd/pte dirty (_PAGE_MODIFIED) for software. Reviewed-by: Guo Ren <guoren@kernel.org> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
bf2f34a506
commit
54e6cd42a1
arch/loongarch/include/asm
|
@ -357,7 +357,9 @@ static inline pte_t pte_mkdirty(pte_t pte)
|
|||
|
||||
static inline pte_t pte_mkwrite(pte_t pte)
|
||||
{
|
||||
pte_val(pte) |= (_PAGE_WRITE | _PAGE_DIRTY);
|
||||
pte_val(pte) |= _PAGE_WRITE;
|
||||
if (pte_val(pte) & _PAGE_MODIFIED)
|
||||
pte_val(pte) |= _PAGE_DIRTY;
|
||||
return pte;
|
||||
}
|
||||
|
||||
|
@ -457,7 +459,9 @@ static inline int pmd_write(pmd_t pmd)
|
|||
|
||||
static inline pmd_t pmd_mkwrite(pmd_t pmd)
|
||||
{
|
||||
pmd_val(pmd) |= (_PAGE_WRITE | _PAGE_DIRTY);
|
||||
pmd_val(pmd) |= _PAGE_WRITE;
|
||||
if (pmd_val(pmd) & _PAGE_MODIFIED)
|
||||
pmd_val(pmd) |= _PAGE_DIRTY;
|
||||
return pmd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue