Skip to contentSkip to conversation

THP COW support for private executable file mmap

PATCH zhangqilong 2 participants 2 messages Dec 16, 2025 – Dec 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 21 lines · zhangqilong
Quoted 7 lines
Quoted 7 lines · Matthew Wilcox
Quoted 6 lines · Zhang Qilong
Quoted 4 lines

This patch series implementate THP COW for private executable file mmap. It's major designed to increase the iTLB cache hit rate for hot patching application, and we add a new sysfs knob to disable or enable it.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

You're going to have to provide data to get this patch in. We've deliberately not done this in the past due to memory consumption

overhead.

Quoted 3 lines

So you need to prove that's now the wrong decision to make.

Microbenchmarks would be a bare minimum, but what are really

needed

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

are numbers from actual workloads.

In addition, the sysfs toggle is rather horrible. It's rather clear that this is not a system-wide setting to be made, as you likely only want that behavior (if at all ...) for a handful of special processes I assume?

Quoted 8 lines
Quoted 4 lines

Year, it's not a system-wide setting. We consider enabling this option only when applying hot patches to special processes. If the sysfs toggle is unavailable, we will evaluate the overall memory impact on the system after removing it. Thanks very much for your suggestion.

I don't think we want this as any kind of default behavior. But the system toggle is really also not what we want. Could we use some per-VMA or per- file hints to affect the policy?

It's really a good idea. Maybe could setting a xx flag to VMA, but it need hold write lock and touch VMA. let me have a think how to implement per-VMA or per-file policy or other better hints.

I have a thought that, how about adding a new flag(in ptrace, uprobes...) and passing to faultin_page() to mark the exec PMD COW policy?

Quoted 3 lines

Note that your proposal will likely interact in bad ways with uprobes, after removing uprobes again.

Year, good catch here, it's really need be seriously considered.

Quoted 5 lines

--
Cheers

David

#1 lore raw
Quoted 34 lines · zhangqilong
Quoted 21 lines · zhangqilong
Quoted 7 lines
Quoted 7 lines · Matthew Wilcox
Quoted 6 lines · Zhang Qilong
Quoted 4 lines

This patch series implementate THP COW for private executable file mmap. It's major designed to increase the iTLB cache hit rate for hot patching application, and we add a new sysfs knob to disable or enable it.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

You're going to have to provide data to get this patch in. We've deliberately not done this in the past due to memory consumption

overhead.

Quoted 3 lines

So you need to prove that's now the wrong decision to make.

Microbenchmarks would be a bare minimum, but what are really

needed

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

are numbers from actual workloads.

In addition, the sysfs toggle is rather horrible. It's rather clear that this is not a system-wide setting to be made, as you likely only want that behavior (if at all ...) for a handful of special processes I assume?

Quoted 8 lines
Quoted 4 lines

Year, it's not a system-wide setting. We consider enabling this option only when applying hot patches to special processes. If the sysfs toggle is unavailable, we will evaluate the overall memory impact on the system after removing it. Thanks very much for your suggestion.

I don't think we want this as any kind of default behavior. But the system toggle is really also not what we want. Could we use some per-VMA or per- file hints to affect the policy?

It's really a good idea. Maybe could setting a xx flag to VMA, but it need hold write lock and touch VMA. let me have a think how to implement per-VMA or per-file policy or other better hints.

Quoted 8 lines

I have a thought that, how about adding a new flag(in ptrace, uprobes...) and passing to faultin_page() to mark the exec PMD COW policy?

Quoted 3 lines

Note that your proposal will likely interact in bad ways with uprobes, after removing uprobes again.

Year, good catch here, it's really need be seriously considered.

I'll reply on v2 with the issue I have in mind.

Signature · 3 lines
Cheers

David