linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yongfeng Wang <wangyongfeng5@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org
Subject: [RFC] Proposal: Kernel-supported mechanism for shared memory state cleanup on exit
Date: Sat, 20 Dec 2025 09:07:00 +0800	[thread overview]
Message-ID: <CAAqLnKL540gM6xLZonhSmhO+rWtWPO9_UJSfmsPWjVcTzf_mgQ@mail.gmail.com> (raw)

Hi Andrew Morton,

I’m looking for your feedback on a gap in the current synchronization
primitives: the lack of a general, kernel-supported mechanism to clean
up user-space shared memory state (e.g., refcounts, ownership flags)
when a process exits unexpectedly (SIGKILL/crash).

The Problem: While robust_list handles mutexes and SEM_UNDO handles
System V semaphores, there is no generic way to perform simple,
reversible operations (like clearing a bit or decrementing a counter)
on arbitrary shared memory upon process death. User-space recovery is
often unreliable in crash scenarios.

The Idea: A syscall or prctl extension allowing a process to register
a limited number of "deferred actions" on shared memory addresses.

Target: Small, management-plane state.

Operations: Atomic write/add/clear.

Execution: Handled by the kernel during do_exit(), ensuring atomicity
even if the process is killed.

Questions:

Do you see this as a problem worth solving at the kernel level, or
should this remain strictly in user-space?

Are there fundamental architectural blockers (e.g., page fault
handling during do_exit) that make this impractical?

I have a more detailed technical draft ready if this is a direction
you’d consider.

Best regards,

Yongfeng Wang


                 reply	other threads:[~2025-12-20  1:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAqLnKL540gM6xLZonhSmhO+rWtWPO9_UJSfmsPWjVcTzf_mgQ@mail.gmail.com \
    --to=wangyongfeng5@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox