Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/ksm: remove redundant code in ksm_fork

Since commit 3c6f33b7273a ("mm/ksm: support fork/exec for prctl"), when a
child process is forked, the MMF_VM_MERGE_ANY flag will be inherited in
mm_init(). So, it's unnecessary to set the flag in ksm_fork().

Link: https://lkml.kernel.org/r/20240402024934.1093361-1-tujinjiang@huawei.com
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Jinjiang Tu and committed by
Andrew Morton
7edea4c6 0ae0b2b3

+2 -10
+2 -10
include/linux/ksm.h
··· 45 45 46 46 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm) 47 47 { 48 - int ret; 49 - 50 - if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) { 51 - ret = __ksm_enter(mm); 52 - if (ret) 53 - return ret; 54 - } 55 - 56 - if (test_bit(MMF_VM_MERGE_ANY, &oldmm->flags)) 57 - set_bit(MMF_VM_MERGE_ANY, &mm->flags); 48 + if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) 49 + return __ksm_enter(mm); 58 50 59 51 return 0; 60 52 }