Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] remove mmap_action success, error hooks
@ 2026-05-21 16:21 Lorenzo Stoakes
  2026-05-21 16:21 ` [PATCH 1/3] drivers/char/mem: eliminate unnecessary use of success_hook Lorenzo Stoakes
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lorenzo Stoakes @ 2026-05-21 16:21 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Greg Kroah-Hartman, David Hildenbrand,
	Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Jann Horn, Pedro Falcato,
	linux-kernel, linux-mm

The mmap_action->success_hook was a strange beast added to enable code
which appeared to absolutely require access to a VMA pointer to work
correctly.

Primarily this was for hugetlb, however a different approach will be taken
there, as clearly more work is required to figure out a sensible way of
converting hugetlb to use mmap_prepare.

The other user was the memory char driver, specifically /dev/zero which has
the unusual property of explicitly setting file-backed VMAs anonymous.

Providing the success hook was always foolish, as it allowed drivers a way to
workaround the restriction that they should not access a pointer to a
not-yet-correctly-initialised VMA - which defeats the purpose of the
mmap_prepare work.

We can achieve the same thing in memory char driver without needing the
success hook, so this series removes that, then removes the success hook
altogether.

The error hook is also unnecessary - the motivation for this was for
functions which need to filter the error code when performing an mmap
action in order to avoid breaking userspace.

We can achieve this by just providing a field for the error code. Doing
this means we don't have to worry about the hook doing anything odd.

We also add a check to ensure the error code is in fact valid.

Again the memory char driver is the only current user of this, so this
series updates it to use that.

After this change mmap_action has no custom hooks at all, which seems
rather more cromulent than before.

Lorenzo Stoakes (3):
  drivers/char/mem: eliminate unnecessary use of success_hook
  mm/vma: remove mmap_action->success_hook
  mm/vma: eliminate mmap_action->error_hook, introduce error_filter

 drivers/char/mem.c              | 25 ++++++-------------------
 include/linux/mm.h              |  5 +++++
 include/linux/mm_types.h        | 19 +++----------------
 mm/util.c                       | 31 +++++++++++++++++++++----------
 mm/vma.c                        |  2 ++
 tools/testing/vma/include/dup.h | 19 +++----------------
 6 files changed, 40 insertions(+), 61 deletions(-)

--
2.54.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-21 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 16:21 [PATCH 0/3] remove mmap_action success, error hooks Lorenzo Stoakes
2026-05-21 16:21 ` [PATCH 1/3] drivers/char/mem: eliminate unnecessary use of success_hook Lorenzo Stoakes
2026-05-21 17:32   ` Lorenzo Stoakes
2026-05-21 16:21 ` [PATCH 2/3] mm/vma: remove mmap_action->success_hook Lorenzo Stoakes
2026-05-21 16:21 ` [PATCH 3/3] mm/vma: eliminate mmap_action->error_hook, introduce error_filter Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox