lkml.org 
[lkml]   [2022]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 1/3] mm/mprotect: Fix soft-dirty check in can_change_pte_writable()
From
Date
On Jul 22, 2022, at 12:08 AM, David Hildenbrand <david@redhat.com> wrote:

>> +static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma)
>> +{
>> + /*
>> + * NOTE: we must check this before VM_SOFTDIRTY on soft-dirty
>> + * enablements, because when without soft-dirty being compiled in,
>> + * VM_SOFTDIRTY is defined as 0x0, then !(vm_flags & VM_SOFTDIRTY)
>> + * will be constantly true.
>> + */
>> + if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY))
>> + return false;
>> +
>> + /*
>> + * Soft-dirty is kind of special: its tracking is enabled when the
>> + * vma flags not set.
>> + */
>> + return !(vma->vm_flags & VM_SOFTDIRTY);
>> +}
>
> That will come in handy in other patches I'm cooking.

clear_refs_write() also comes to mind as well (for consistency; I see no
correctness or performance issue).

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