* [LSF/MM/BPF TOPIC] Improve KSM for code patching use-cases
@ 2025-01-28 15:22 Mathieu Desnoyers
2025-04-08 14:30 ` Mathieu Desnoyers
0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2025-01-28 15:22 UTC (permalink / raw)
To: lsf-pc; +Cc: linux-mm
Hi,
I submit this topic proposal for your consideration:
We are implementing a code patching library which essentially
reimplements static keys for userspace. (work in progress,
not released yet)
One of the problems we face when patching code from libraries
and executables from nops to jumps is Copy-on-Write (CoW), which
increases memory use and prevents sharing code pages across
processes.
I suspect we can improve Kernel Samepage Merging (KSM) to
better handle scenarios where pages which are the result of
a CoW from a given file/offset are modified shortly after
their CoW, and then are stable for most of their lifetime.
This would allow merging CoW pages when the resulting
modification makes them identical again. This could be
achieved by tracking possible duplicates on a per
file/offset basis, which should be more efficient than
a global scan.
I would like to discuss this topic with Filesystem and MM
experts to get their input.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LSF/MM/BPF TOPIC] Improve KSM for code patching use-cases
2025-01-28 15:22 [LSF/MM/BPF TOPIC] Improve KSM for code patching use-cases Mathieu Desnoyers
@ 2025-04-08 14:30 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2025-04-08 14:30 UTC (permalink / raw)
To: lsf-pc; +Cc: linux-mm
On 2025-01-28 10:22, Mathieu Desnoyers wrote:
> Hi,
>
> I submit this topic proposal for your consideration:
>
> We are implementing a code patching library which essentially
> reimplements static keys for userspace. (work in progress,
> not released yet)
>
> One of the problems we face when patching code from libraries
> and executables from nops to jumps is Copy-on-Write (CoW), which
> increases memory use and prevents sharing code pages across
> processes.
>
> I suspect we can improve Kernel Samepage Merging (KSM) to
> better handle scenarios where pages which are the result of
> a CoW from a given file/offset are modified shortly after
> their CoW, and then are stable for most of their lifetime.
>
> This would allow merging CoW pages when the resulting
> modification makes them identical again. This could be
> achieved by tracking possible duplicates on a per
> file/offset basis, which should be more efficient than
> a global scan.
>
> I would like to discuss this topic with Filesystem and MM
> experts to get their input.
Here are the slides I presented during my talk:
https://drive.google.com/file/d/18EkWsvILbPlTDRHI22sHIWUhlqBsYILy/view?usp=sharing
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-08 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-28 15:22 [LSF/MM/BPF TOPIC] Improve KSM for code patching use-cases Mathieu Desnoyers
2025-04-08 14:30 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox