Skip to content

[compute/copy-on-write]: Add a new quiz about Transparent Huge Pages#220

Open
robertmercea wants to merge 2 commits into
cs-pub-ro:mainfrom
robertmercea:lab-7-fork-faults-new-quiz
Open

[compute/copy-on-write]: Add a new quiz about Transparent Huge Pages#220
robertmercea wants to merge 2 commits into
cs-pub-ro:mainfrom
robertmercea:lab-7-fork-faults-new-quiz

Conversation

@robertmercea

@robertmercea robertmercea commented Jan 21, 2026

Copy link
Copy Markdown

Prerequisite Checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Updated relevant documentation (if needed).

Description of changes

  • Change NUM_PAGES to 256 in the fork-faults guide to avoid Transparent Huge Pages (THP) being triggered
    • Previously, the number was set to 1024, which triggered the THP mechanism
    • The students would have only seen 2 page faults from the parent program instead of the expected 1024 (as per the course material), which was counterintuitive
  • Create a new quiz about THP
    • Added explanations about THP
    • Included external resources for further reading
  • Add the new quiz in config.yaml

- Change NUM_PAGES to 256 in the original code to avoid Transparent Huge
  Pages (THP) being triggered, allowing students to properly view the
  expected page fault numbers, as shown in the course material
- Create a new quiz about THP, explaining the low number of page faults
  caused by the program, despite increasing the page count
- Add the new quiz in config.yaml

Signed-off-by: robertmercea <robertmercea@gmail.com>

@teodutu teodutu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THP is legit, but not always enabled by default. You'd have to configure them in: /sys/kernel/mm/transparent_hugepage/hugepages-<size>/enabled.

For example, my configs are:

$ cat /sys/kernel/mm/transparent_hugepage/hugepages-2048kB/enabled 
always inherit madvise [never]

Which means they're disabled. So I suggest you add instructions to enable THP of various sizes and then have students re-run the faults demo to see the differences. Also add this link, it explains how they affect the TLB: https://docs.kernel.org/admin-guide/mm/transhuge.html.

- Added details about how Transparent Huge Pages (THP) work in Linux
- Added a simple guide on how to enable THP

Signed-off-by: robertmercea <robertmercea@gmail.com>
@robertmercea robertmercea force-pushed the lab-7-fork-faults-new-quiz branch from 5b564b6 to 7b8750e Compare January 24, 2026 19:57
@robertmercea

Copy link
Copy Markdown
Author

I've added instructions to enable THP as requested. Further explanations about THP have been added in hopes of encouraging students to do the bonus task, or at least to have a better understanding of the concept.
I've also mentioned that the sudo commands that enable THP only affect their system temporarily, knowing that it might be a deterrent for those who do not wish to tinker too much with their devices.

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.

2 participants