On 12.09.25 11:21, Chunyan Zhang wrote:
On Fri, 12 Sept 2025 at 16:41, David Hildenbrand <david@xxxxxxxxxx> wrote:
[...]
+/*
+ * We should remove the VM_SOFTDIRTY flag if the soft-dirty bit is
+ * unavailable on which the kernel is running, even if the architecture
+ * provides the resource and soft-dirty is compiled in.
+ */
+#ifdef CONFIG_MEM_SOFT_DIRTY
+ if (!pgtable_soft_dirty_supported())
+ mnemonics[ilog2(VM_SOFTDIRTY)][0] = 0;
+#endif
You can now drop the ifdef.
Ok, you mean define VM_SOFTDIRTY 0x08000000 no matter if
MEM_SOFT_DIRTY is compiled in, right?
Then I need memcpy() to set mnemonics[ilog2(VM_SOFTDIRTY)] here.
The whole hunk will not be required when we make sure VM_SOFTDIRTY never
gets set, correct?
Oh no, this hunk code does not set vmflag.
The mnemonics[ilog2(VM_SOFTDIRTY)] is for show_smap_vma_flags(),
something like below:
# cat /proc/1/smaps
5555605c7000-555560680000 r-xp 00000000 fe:00 19
/bin/busybox
...
VmFlags: rd ex mr mw me sd
'sd' is for soft-dirty
I think this is still needed, right?
If nobody sets VM_SOFTDIRTY in vma->vm_flags, then we will never print it.
So you can just leave the "#ifdef CONFIG_MEM_SOFT_DIRTY" as is to handle
the VM_SOFTDIRTY=0 case.
So you should not have to change anything in show_smap_vma_flags().
[...]
That should be handled with the above never-set-VM_SOFTDIRTY.
We don't need to check if (!pgtable_soft_dirty_supported()) if I
understand correctly.
Hm, let me think about that. No, I think this has to stay as the comment
says, so this case here is special.
I will cook a new version and then we can discuss further based on the
new patch.
Sounds good!
--
Cheers
David / dhildenb