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

Prevent process pages from being swapped #32

Merged
merged 1 commit into from
Dec 14, 2022
Merged

Conversation

Atrate
Copy link
Contributor

@Atrate Atrate commented Nov 26, 2022

Closes: #31

Seems to work, tests done:

  1. Create high memory pressure via stress --vm 20 --vm-bytes 1024M --vm-hang 1
  2. Set swappiness to max echo "200" | sudo tee /proc/sys/vm/swappiness
  3. Launch vramfs with and without the fix (in this case with root privileges and without, as it can't protect pages without root)
  4. Check the resulting processes /proc/<PID>/status

Results:

  1. Process with protection:
VmSwap:	       0 kB
  1. Proces without protection:
VmSwap:	       784 kB

Signed-off-by: Atrate [email protected]

@Atrate Atrate marked this pull request as ready for review November 26, 2022 15:37
@Atrate Atrate changed the title WIP: Prevent process pages from being swapped Prevent process pages from being swapped Nov 26, 2022
@Atrate
Copy link
Contributor Author

Atrate commented Nov 26, 2022

@Overv Having carried out simple tests as outlined in OP, this PR is now ready for review.

@Atrate Atrate mentioned this pull request Nov 27, 2022
@Overv
Copy link
Owner

Overv commented Nov 27, 2022

I'll review this once I find some time.

@Overv
Copy link
Owner

Overv commented Dec 12, 2022

I see that you deleted your comment about other processes that may still be swapped out. Was that a mistake or is that still a concern after this PR?

@Atrate
Copy link
Contributor Author

Atrate commented Dec 13, 2022

I traced the source of that particular freezing to the fact that I was using linux-hardened, not that I was swapping on VRAM. Other processes being swapped out should technically not be a problem, as drivers are kernel threads, which AFAIK can't be swapped out, but once I confirm that the kernel I am using right now is fully stable, I'll go back to using swap on VRAM and watching for freezes.

@Overv Overv merged commit 829b1f2 into Overv:master Dec 14, 2022
@Overv
Copy link
Owner

Overv commented Dec 14, 2022

Cool 👍

@Atrate Atrate deleted the mlockall branch August 12, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] vramfs deadlock caused by vramfs getting swapped to vram swap
2 participants