From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Mike Rapoport <rppt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Mason <mason@kernel.org>, Peter Xu <peterx@redhat.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 1/2] mm/userfaultfd: account memory allocated for unmap events
Date: Mon, 30 Nov 2026 11:45:30 +0100 [thread overview]
Message-ID: <54b1ffe9-6fcb-42fc-9078-3b79268d0537@kernel.org> (raw)
In-Reply-To: <20261129-fixes-uffd-fork-acct-v1-1-f39cc449d92c@kernel.org>
On 11/29/26 17:25, Mike Rapoport wrote:
> From: Chris Mason <mason@kernel.org>
>
> When memory registered with UFFD_FEATURE_EVENT_UNMAP is unmapped,
> userfaultfd_unmap_prep() allocates a small structure for each userfaultfd
> context that should be notified. These structures are usually freed only
> after the monitor reads the events, so userspace controls how many of them
> are allocated and how long they stay around.
>
> They are allocated with GFP_KERNEL, so this memory is not charged to any
> memory cgroup and memory cgroup limits don't apply to it.
>
> Use GFP_KERNEL_ACCOUNT to charge this memory to the memory cgroup of the
> task that does the unmap.
>
> When the memory cgroup reaches its limit, the allocation can now trigger
> reclaim or the OOM killer there. If the charge fails, it is handled in the
> same way as any other failure of this allocation.
>
> Fixes: 897ab3e0c49e ("userfaultfd: non-cooperative: add event for memory unmaps")
> Signed-off-by: Chris Mason <mason@kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> [rppt: rewrote the changelog]
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
next prev parent reply other threads:[~2026-11-30 10:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 16:25 [PATCH 0/2] mm/userfaultfd: fixes for unmap and fork events Mike Rapoport
2026-11-29 16:25 ` [PATCH 1/2] mm/userfaultfd: account memory allocated for unmap events Mike Rapoport
2026-11-30 10:45 ` David Hildenbrand (Arm) [this message]
2026-12-02 23:16 ` Chris Down
2026-11-29 16:25 ` [PATCH 2/2] mm/userfaultfd: drop fork context reference outside event_wqh.lock Mike Rapoport
2026-11-30 10:46 ` David Hildenbrand (Arm)
2026-12-02 23:16 ` Chris Down
2026-11-29 17:58 ` [PATCH 0/2] mm/userfaultfd: fixes for unmap and fork events Jose A. Perez de Azpillaga
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=54b1ffe9-6fcb-42fc-9078-3b79268d0537@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mason@kernel.org \
--cc=peterx@redhat.com \
--cc=rppt@kernel.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