All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Xu Xin (vivo)" <xu.xin@linux.dev>
Cc: akpm@linux-foundation.org, chengming.zhou@linux.dev,
	donettom@linux.ibm.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 3/3] selftests/mm: verify ksm_zero_pages is not inherited on fork
Date: Tue, 24 Nov 2026 09:04:51 +0100	[thread overview]
Message-ID: <c4f270f1-3196-4ae0-8a7c-7b61155285ca@kernel.org> (raw)
In-Reply-To: <awT6Yc/rFuyp2r13@dgvxl46587.localhost.localdomain>

On 11/24/26 03:45, Xu Xin (vivo) wrote:
> On Mon, Nov 23, 2026 at 05:49:30PM +0100, David Hildenbrand (Arm) wrote:
>> On 11/23/26 04:45, Xu Xin (vivo) wrote:
>>> Extend test_fork_ksm_merging_page_count() to enable use_zero_pages and
>>> merge zero pages alongside non-zero pages before fork(), verifying that>
>> neither ksm_merging_pages nor ksm_zero_pages is inherited by the child.
>>>
>>> Signed-off-by: Xu Xin (vivo) <xu.xin@linux.dev>
>>> ---
>>>  .../selftests/mm/ksm_functional_tests.c       | 44 +++++++++++++++----
>>>  1 file changed, 35 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
>>> index b871d5656688..0e128c579d5c 100644
>>> --- a/tools/testing/selftests/mm/ksm_functional_tests.c
>>> +++ b/tools/testing/selftests/mm/ksm_functional_tests.c
>>> @@ -655,45 +655,71 @@ static void test_prot_none(void)
>>>  	munmap(map, size);
>>>  }
>>>  
>>> -static void test_fork_ksm_merging_page_count(void)
>>> +static void test_fork_ksm_statistic_count(void)
>>
>> "statistic_count" sounds odd. did you mean "statistics" or "counters". Below you
>> use "stats".
> 
> Yes, I meant "counters" (my phrasing was inaccurate). I will rename it to
> test_fork_ksm_counters() in v4.
> 
>>>  	}
>>>  
>>> -	ksft_test_result_pass("ksm_merging_pages is not inherited after fork\n");
>>> -
>>> +	ksft_test_result_pass("ksm_merging_pages and ksm_zero_pages are reset after fork\n");
>>> +unmap_zero:
>>> +	munmap(zero_map, size);
>>>  unmap:
>>>  	ksm_stop();
>>>  	munmap(map, size);
>>
>> This ordering is odd.
>>
>> Why stop in between?
>>
>> Also, I suggest using a single label, like:
>>
>> char *zero_map = MAP_FAILED, *map = MAP_FAILED;
>>
> 
> Agreed, the ordering was just kept from the original code and looks odd.
> I will unify this into a single cleanup label in v4, unmapping both
> regions cleanly before calling ksm_stop().

Thanks!

-- 
Cheers,

David

      reply	other threads:[~2026-11-24  8:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  3:41 [PATCH v3 0/3] mm/ksm: fix ksm_zero_pages accounting on fork Xu Xin (vivo)
2026-11-23  3:43 ` [PATCH v3 1/3] mm/ksm: do not inherit ksm_zero_pages counter or PTE markers " Xu Xin (vivo)
2026-11-23  3:43 ` Xu Xin (vivo)
2026-11-23 16:38   ` David Hildenbrand (Arm)
2026-11-23  3:45 ` [PATCH v3 2/3] selftests/mm: fix false-positive and racy KSM fork test Xu Xin (vivo)
2026-11-23 16:43   ` David Hildenbrand (Arm)
2026-11-24  3:46   ` sashiko-bot
2026-11-23  3:45 ` [PATCH v3 3/3] selftests/mm: verify ksm_zero_pages is not inherited on fork Xu Xin (vivo)
2026-11-23 16:49   ` David Hildenbrand (Arm)
2026-11-24  2:45     ` Xu Xin (vivo)
2026-11-24  8:04       ` David Hildenbrand (Arm) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4f270f1-3196-4ae0-8a7c-7b61155285ca@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=donettom@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=xu.xin@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.