]> www.infradead.org Git - users/willy/xarray.git/commit
mm: refactor vma_merge() into modify-only vma_merge_existing_range()
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Fri, 30 Aug 2024 18:10:21 +0000 (19:10 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Sep 2024 04:15:55 +0000 (21:15 -0700)
commitcc8cb3697a8d8eabe1fb9acb8768b11c1ab607d8
tree5e02b425e3f4f50f2adfdec1fc9f6bc103526f52
parent65e0aa64df916861ad8579e23f885e56e5ec8647
mm: refactor vma_merge() into modify-only vma_merge_existing_range()

The existing vma_merge() function is no longer required to handle what
were previously referred to as cases 1-3 (i.e.  the merging of a new VMA),
as this is now handled by vma_merge_new_vma().

Additionally, simplify the convoluted control flow of the original,
maintaining identical logic only expressed more clearly and doing away
with a complicated set of cases, rather logically examining each possible
outcome - merging of both the previous and subsequent VMA, merging of the
previous VMA and merging of the subsequent VMA alone.

We now utilise the previously implemented commit_merge() function to share
logic with vma_expand() de-duplicating code and providing less surface
area for bugs and confusion.  In order to do so, we adjust this function
to accept parameters specific to merging existing ranges.

Link: https://lkml.kernel.org/r/2cf6016b7bfcc4965fc3cde10827560c42e4f12c.1725040657.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Bert Karwatzki <spasswolf@web.de>
Cc: Jeff Xu <jeffxu@chromium.org>
Cc: Jiri Olsa <olsajiri@gmail.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vma.c
tools/testing/vma/vma.c