ValveSoftware / ValveSoftware/Proton

Transparent Huge Page support

Open
#5,816 24 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
C++
Stars
32.8k
Forks
1.6k
PR merge metrics
PR metrics pending

Description

Feature Request

I confirm:

  • that I haven't found another request for this feature.
  • that I have checked whether there are updates for my system available that
    contain this feature already.

Description

Add an environment variable for turning on transparent huge page support on the heap via madvise(addr, size, MADV_HUGEPAGE).

Additional changes could be made to further improve transparent huge page support, such as:

  1. Modifying the heap to allocate huge page aligned regions to further enhance this feature.
  2. Implementing MEM_LARGE_PAGES in VirtualAlloc in Wine.

Justification [optional]

This is Linux specific, so I doubt Wine would accept the patch.

This should be done because fewer TLB misses from the use of transparent huge pages should slightly improve CPU bound performance in games running under Proton. Implementing an option to use to turn it on for evaluation purposes would probably be best. That would allow the community to gather data to determine whether it should be on by default.

Risks [optional]

Setting it system-wide is said to harm performance:

https://www.reddit.com/r/linux_gaming/comments/uhfjyt/comment/i75z26g/

It is possible that this could cause a performance regression.

References [optional]

There are claims on reddit that games can benefit from this:

https://www.reddit.com/r/linux_gaming/comments/uhfjyt/underrated_advice_for_improving_gaming/

The manual page states:

This feature is primarily aimed at applications that use large mappings of data and access large regions of that memory at a time

https://man7.org/linux/man-pages/man2/madvise.2.html

This describes a video game.

Microsoft documentation on Windows MEM_LARGE_PAGES:

https://docs.microsoft.com/en-us/windows/win32/memory/large-page-support

Kernel documentation on THP support:

https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Linux madvise(2) and transparent huge page documentation linked in the issue, then trace how Proton exposes environment variables and initializes its heap. Done means an environment-controlled THP madvise option works on Linux, with its performance and regression risks suitable for evaluation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.