THP usage regression after aligned metadata optimization for faster frees

Open
#1,502 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c
Domain
performance

Research direction

Read the aligned page metadata optimization and the linked version 2 PR to understand why allow_large=false affects the THP hint in version 3. Trace the fallback allocation path and where the THP page hint is selected, then compare the behavior with version 2. Done means confirming whether the same fix applies and verifying that the affected allocation path preserves the intended THP hint.

Written by the indexing model from the issue text.

Description

It looks like THP usage regressed after optimizing free with aligned page metadata. The second commit of this work effort introduces an fallback to allocate from the OS directly with allow_large=false. In version 3, allow_large=false disables the THP page hint. So, these pages don't get a THP hint. This leads to a major regression in one of our workloads (a TPC-DS benchmark query regresses from 13.5s to 18s) due to more page faults.

This PR against version 2 of mimalloc reasons why allow_large=false should not be involved in deciding the THP hint. Could you check if the same fix should be applied to version 3 now?

Dominant language
C
Stars
13.6k
Forks
1.2k
Avg merge
18h 12m
Merged PRs (30d)
20

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from microsoft/mimalloc

All issues in microsoft/mimalloc

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.