v1 2026-07-24

异步进程地址空间销毁 · v1

引入 CONFIG_ASYNC_MM_TEARDOWN,将大进程的 __mmput() 推迟到专用 mm_reaper 内核线程,减少退出路径延迟。

原始补丁链接

子 Patch(7)

1/7
mm: add CONFIG_ASYNC_MM_TEARDOWN scaffolding for off-CPU exit teardown
[mm: add CONFIG_ASYNC_MM_TEARDOWN scaffolding for off-CPU exit teardown] Address-space teardown on process exit runs synchronously in the dying task’s context: exit_mm() -> mmput() -> __mmput() -> exi
2/7
mm: dispatch __mmput() to an mm_reaper kthread via llist
[mm: dispatch __mmput() to an mm_reaper kthread via llist] Introduce a single dedicated, freezable, sleepable kthread (mm_reaper) modeled on oom_reaper, and the machinery to route the deferrable unit
3/7
mm/oom_kill: mark an OOM victim's mm with MMF_OOM_TARGETED
[mm/oom_kill: mark an OOM victim’s mm with MMF_OOM_TARGETED] A later part of this series defers the address-space teardown of large exiting processes to a kernel thread (mm_reaper) instead of running
4/7
mm: gate async teardown on RSS with pending-pages backpressure
[mm: gate async teardown on RSS with pending-pages backpressure] Deferring every exit would churn small processes for no benefit and let unreaped memory grow without bound. Split the defer decision in
5/7
mm: add runtime toggle and sysctls for async teardown
[mm: add runtime toggle and sysctls for async teardown] Add the userspace interface that arms and tunes off-CPU exit teardown, and the static key that gates it. Introduce async_mm_teardown_key (stati
6/7
mm: add tracepoints and vmstat counters for async teardown
[mm: add tracepoints and vmstat counters for async teardown] Add observability for the deferred teardown path: - vmstat (CONFIG_ASYNC_MM_TEARDOWN, in /proc/vmstat): async_mm_teardown_queued -
7/7
exit: route exit_mm()'s final mmput() through mmput_exit()
This makes the series operative. So far, nothing called mmput_exit(). Switch exit_mm() from mmput() to mmput_exit(), so the exiting task’s final reference drop can defer the address-space teardown to