Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.1] Track PF uksmd patches #25

Closed
wants to merge 5 commits into from
Closed

[6.1] Track PF uksmd patches #25

wants to merge 5 commits into from

Conversation

kakra
Copy link
Owner

@kakra kakra commented Mar 11, 2023

Export patch series: https://github.com/kakra/linux/pull/25.patch

  • post-factum KSM patches: for use with uksmd, merges identical memory pages to reduce cache and memory pressure, useful when running similar containers in parallel

pfactum and others added 5 commits December 11, 2022 23:29
Move MADV_MERGEABLE part of ksm_madvise() into a dedicated helper since
it will be further used for marking VMAs to be merged forcibly.

This does not bring any functional changes.

Signed-off-by: Oleksandr Natalenko <[email protected]>
Move MADV_UNMERGEABLE part of ksm_madvise() into a dedicated helper
since it will be further used for unmerging VMAs forcibly.

This does not bring any functional changes.

Signed-off-by: Oleksandr Natalenko <[email protected]>
Yes, I know, this looks like a duplicate of `process_madvise()`. There
are two reasons to do this, however:

1. implementing a new syscall is exceptionally easy and takes less code
   lines than ugly `/proc`-based API, although it imposes slightly more
   difficult usage onto userspace

2. the code gets actually much closer to be merged with `process_madvise()`,
   and this is a small step in that direction.

So, basically, the `pmadv_ksm()` syscall is a twin of
`process_madvise()`, but with two differences:

1. it works with MADV\_(UN)\?MERGEABLE hints only

2. it affects the whole address space of the target task

The second difference is likely to disappear in case two syscalls are
merged, but that's up to either me or to someone else to re-think how to
do it.

uksmd is already able to use this syscall.

Signed-off-by: Oleksandr Natalenko <[email protected]>
Present `pmadv_ksm()` syscall for all the arches.

Signed-off-by: Oleksandr Natalenko <[email protected]>
As `pmadv_ksm()` syscall is out-of-tree, maintain a separate
`/sys/kernel/pmadv/ksm` file with a syscall number so that userspace
tools can always know what to use in runtime even if the syscall number
shifts after adding another in-tree syscall.

The idea is borrowed from futex2 submission.

Signed-off-by: Oleksandr Natalenko <[email protected]>
@kakra kakra changed the base branch from master to base-6.1 March 11, 2023 15:55
@kakra kakra marked this pull request as draft March 11, 2023 16:20
@kakra
Copy link
Owner Author

kakra commented Nov 26, 2023

Rebased to #27

@kakra kakra closed this Nov 26, 2023
@kakra kakra added the done To be superseded by next LTS label Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done To be superseded by next LTS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants