Thread (66 messages) 66 messages, 5 authors, 2021-03-29

Re: [PATCH v23 12/28] x86/mm: Update ptep_set_wrprotect() and pmdp_set_wrprotect() for transition from _PAGE_DIRTY to _PAGE_COW

From: Kirill A. Shutemov <hidden>
Date: 2021-03-22 11:39:43
Also in: linux-arch, linux-doc, linux-mm, lkml

On Mon, Mar 22, 2021 at 11:46:21AM +0100, Peter Zijlstra wrote:
On Mon, Mar 22, 2021 at 01:15:02PM +0300, Kirill A. Shutemov wrote:
quoted
On Tue, Mar 16, 2021 at 08:10:38AM -0700, Yu-cheng Yu wrote:
quoted
quoted
+		pte_t old_pte, new_pte;
+
+		old_pte = READ_ONCE(*ptep);
+		do {
+			new_pte = pte_wrprotect(old_pte);
+		} while (!try_cmpxchg(&ptep->pte, &old_pte.pte, new_pte.pte));
I think this is wrong. You need to update old_pte on every loop iteration,
otherwise you can get in to endless loop.
It is correct, please consider why the old argument is a pointer.
Ah, right. Sorry for the noise.

-- 
 Kirill A. Shutemov
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help