Re: [PATCH 0/5] Add process_memwatch syscall
From: Gabriel Krisman Bertazi
Date: Wed Aug 10 2022 - 12:53:22 EST
"Peter.Enderborg@xxxxxxxx" <Peter.Enderborg@xxxxxxxx> writes:
>>
>> This syscall can be used by the CRIU project and other applications which
>> require soft-dirty PTE bit information. The following operations are
>> supported in this syscall:
>> - Get the pages that are soft-dirty.
>> - Clear the pages which are soft-dirty.
>> - The optional flag to ignore the VM_SOFTDIRTY and only track per page
>> soft-dirty PTE bit
>>
Hi Peter,
(For context, I wrote a previous version of this patch and have been
working with Usama on the current patch).
> Why can it not be done as a IOCTL?
Considering an ioctl is basically a namespaced syscall with extra-steps,
surely we can do it :) There are a few reasons we haven't, though:
1) ioctl auditing/controling is much harder than syscall
2) There is a concern for performance, since this might be executed
frequently by windows applications running over wine. There is an extra
cost with unnecessary copy_[from/to]_user that we wanted to avoid, even
though we haven't measured.
3) I originally wrote this at the time process_memadvise was merged. I
felt it fits the same kind of interface exposed by
process_memadvise/process_mrelease, recently merged.
4) Not obvious whether the ioctl would be against pagemap/clear_refs.
Neither file name describes both input and output semantics.
Obviously, all of those reasons can be worked around, and we can turn
this into an ioctl.
Thanks,
--
Gabriel Krisman Bertazi