Re: [PATCH] mm/ksm: remove redundant code in ksm_fork

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2024/4/4 23:34, David Hildenbrand 写道:
On 02.04.24 04:49, Jinjiang Tu wrote:
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().

Signed-off-by: Jinjiang Tu <tujinjiang@xxxxxxxxxx>
---
  include/linux/ksm.h | 12 ++----------
  1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 401348e9f92b..2e61df795803 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -45,16 +45,8 @@ static inline void ksm_might_unmap_zero_page(struct mm_struct *mm, pte_t pte)     static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
  {
-    int ret;
-
-    if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) {
-        ret = __ksm_enter(mm);
-        if (ret)
-            return ret;
-    }
-
-    if (test_bit(MMF_VM_MERGE_ANY, &oldmm->flags))
-        set_bit(MMF_VM_MERGE_ANY, &mm->flags);
+    if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
+        return __ksm_enter(mm);
        return 0;
  }

I *think* this is correct. :)

Did you run the new ksm_functional_tests in mm/mm-unstable to make sure they still pass? If so

Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

Sorry for late reply, I was on holiday.

I have run the new ksm_functional_tests and the testcases still pass.






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux