Skip to content

Allow exempting some processes from overcommit#5

Open
hach-que wants to merge 2 commits into
EpicGames:mainfrom
RedpointGames:wine-exempt
Open

Allow exempting some processes from overcommit#5
hach-que wants to merge 2 commits into
EpicGames:mainfrom
RedpointGames:wine-exempt

Conversation

@hach-que

Copy link
Copy Markdown
Contributor

This allows you to set e.g. WINE_PREVENT_OVERCOMMIT_EXEMPT=ubaagent.exe to exempt some processes from Wine overcommit prevention.

This is necessary for UbaAgent, which can not tolerate memory allocation failures under some circumstances. In particular, Session::ProcessExited in UbaAgent will occur when processes are exiting due to memory pressure, and this function allocates through the m_deadProcesses.emplace_back call. When Wine overcommit prevention is enabled, the underlying mi_malloc_aligned call from emplace_back can return nullptr, resulting in a segmentation fault.

@adamrehn

Copy link
Copy Markdown
Member

@hach-que thanks for providing this, and apologies for the delay in reviewing the changes! The proposed functionality sounds helpful, but I did have a few questions:

  • Is there any specific benefit in having two separate environment variables (one to toggle the exemption behaviour and one to specify the executable name) rather than just one that's either empty to disable exemption or contains a non-empty executable name to enable exemption? It seems like WINE_PREVENT_OVERCOMMIT_EXEMPT_DEBUG could be removed to simplify things, but perhaps I've overlooked something?

  • If I've understood the code correctly, it looks like it currently checks all of the command-line arguments for the process for matches. That would mean the matching behaviour would apply to any process with one or more command-line arguments that include the value of WINE_PREVENT_OVERCOMMIT_EXEMPT as a substring, rather than only matching the executable name for the process. Was this intentional behaviour, or is it simply that the logic is designed to handle potential scenarios where argv[0] might be wine / wine64 and the Windows executable is argv[1]?

  • At the moment, this just supports specifying a single executable for exemption. Would you be open to expanding the functionality to allow the user to specify a list with multiple (perhaps comma-delimited) items?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants