mm/ksm: move disabling KSM from s390/gmap code to KSM code
authorDavid Hildenbrand <david@redhat.com>
Sat, 22 Apr 2023 21:01:56 +0000 (23:01 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 3 May 2023 00:21:50 +0000 (17:21 -0700)
commit2c281f54f556e1f3266c8cb104adf9eea7a7b742
treeb8884396dc61d0aa9851999d3443644c09806002
parent1150ea9338554ee6685c9f8939cf7202bf5b27cf
mm/ksm: move disabling KSM from s390/gmap code to KSM code

Let's factor out actual disabling of KSM.  The existing "mm->def_flags &=
~VM_MERGEABLE;" was essentially a NOP and can be dropped, because
def_flags should never include VM_MERGEABLE.  Note that we don't currently
prevent re-enabling KSM.

This should now be faster in case KSM was never enabled, because we only
conditionally iterate all VMAs.  Further, it certainly looks cleaner.

Link: https://lkml.kernel.org/r/20230422210156.33630-1-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Stefan Roesch <shr@devkernel.io>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/s390/mm/gmap.c
include/linux/ksm.h
mm/ksm.c