]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: remove unnecessary reset state logic on merge new VMA
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Fri, 25 Oct 2024 12:26:26 +0000 (13:26 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:21 +0000 (21:29 -0700)
commit20603273ec4788daa6caaa8fc42ad66542000d1a
tree75bc65b048fbb65087c6b3b2d5beab0f14057532
parent96bbe443f3efccbb25f5f8b480914cf68c7856b4
mm: remove unnecessary reset state logic on merge new VMA

The only place where this was used was in mmap_region(), which we have now
adjusted to not require this to be performed (we reset ourselves in
effect).

It also created a dangerous assumption that VMG state could be safely
reused after a merge, at which point it may have been mutated in
unexpected ways, leading to subtle bugs.

Note that it was discovered by Wei Yang that there was also an error in
this code - we are comparing vmg->vma with prev after setting it to NULL.

This however had no impact, as we previously reset VMA iterator state
before attempting merge again, but it was useless effort.

In any case, this patch removes all of the logic so also eliminates this
wasted effort.

Link: https://lkml.kernel.org/r/5d9a59eee6498ae017cc87d89aa723de7179f75d.1729858176.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vma.c