Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: xu.xin@linux.dev, "David Hildenbrand" <david@kernel.org>
Cc: "Donet Tom" <donettom@linux.ibm.com>,
	"Chengming Zhou" <chengming.zhou@linux.dev>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/ksm: do not inherit ksm_zero_pages counter or PTE markers on fork
Date: Wed, 18 Nov 2026 08:18:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-220424@kernel.org> (raw)
In-Reply-To: <20261117081821.7211-1-xu.xin@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] mm/ksm: implicit declaration of is_ksm_zero_pte() when
  CONFIG_KSM=n
--

commit 113c3050b4809182bceaba3e1d17c686dedf4a41
Author: Xu Xin (vivo) <xu.xin@linux.dev>

mm/ksm: do not inherit ksm_zero_pages counter or PTE markers on fork

This commit resets the child's ksm_zero_pages counter in ksm_fork() and
clears the dirty-bit marker on KSM-placed zero-page PTEs in
__copy_present_ptes() during fork.

> diff --git a/mm/memory.c b/mm/memory.c
> index d2f48d78b0d7b..4c845b38d4a01 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1160,6 +1160,14 @@ static __always_inline void __copy_present_ptes(struct vm_area_struct *dst_vma,
>  		pte = pte_mkclean(pte);
>  	pte = pte_mkold(pte);
>  
> +	/*
> +	 * Clear the dirty-bit marker on KSM-placed zero-page PTEs in the
> +	 * child so inherited mappings are not accounted against the child or
> +	 * unshared by MADV_UNMERGEABLE.  Special PTEs always have nr == 1.
> +	 */
> +	if (is_ksm_zero_pte(pte))
> +		pte = pte_mkclean(pte);

[Severity: High]
Does this break the build when CONFIG_KSM is disabled?  is_ksm_zero_pte()
is only defined inside the #ifdef CONFIG_KSM block in
include/linux/ksm.h, with no stub for !CONFIG_KSM.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117081821.7211-1-xu.xin@linux.dev?part=1


      parent reply	other threads:[~2026-11-18  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  8:18 [PATCH] mm/ksm: do not inherit ksm_zero_pages counter or PTE markers on fork xu.xin
2026-11-17  9:51 ` David Hildenbrand (Arm)
2026-11-18  3:10   ` Xu Xin (vivo)
2026-11-17 12:27 ` kernel test robot
2026-11-17 16:50 ` kernel test robot
2026-11-18  8:18 ` sashiko-bot [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=sashiko-outbox-220424@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=david@kernel.org \
    --cc=donettom@linux.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox