mm: Update do_vmi_align_munmap() return semantics
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Fri, 30 Jun 2023 02:28:16 +0000 (22:28 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Jul 2023 15:10:56 +0000 (08:10 -0700)
commit408579cd627a15bd703fe3eeb8485fd02726e9d3
treee613e8f73d2321afa2d8f90ecf2f50ee4011ba2a
parente4bd84c069f212c01258e405f86e91f327888e41
mm: Update do_vmi_align_munmap() return semantics

Since do_vmi_align_munmap() will always honor the downgrade request on
the success, the callers no longer have to deal with confusing return
codes.  Since all callers that request downgrade actually want the lock
to be dropped, change the downgrade to an unlock request.

Note that the lock still needs to be held in read mode during the page
table clean up to avoid races with a map request.

Update do_vmi_align_munmap() to return 0 for success.  Clean up the
callers and comments to always expect the unlock to be honored on the
success path.  The error path will always leave the lock untouched.

As part of the cleanup, the wrapper function do_vmi_munmap() and callers
to the wrapper are also updated.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/linux-mm/20230629191414.1215929-1-willy@infradead.org/
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/mm.h
mm/mmap.c
mm/mremap.c