From nobody Fri Oct 2 03:43:14 2026 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 885C914A4F0 for ; Wed, 5 Aug 2026 11:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785927819; cv=none; b=uC58VNx+gz+g2Ews4fx1WOzOL8bFzTqwzNcVulHmrZrn9cbBLboF5gVHYsGH6oI6NIwsK1CHB6wn2pt7DYRPuVROhgZL8EGgDjjWMz2Twho2tHSsiwj8YKIV+a/FBhu8dm84uJ8sggCzBFuAInXJ2a9sQy+XZIYOkTIHQPfKu08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785927819; c=relaxed/simple; bh=QZ6lKvnhbVeHlU6U3SVBxx8dvMrA3U0MLhqi1maPH58=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=rPwFYMYJwnptVfIgcwwvZ7ToHNgwsK/ePhQmjgjM8a8g+nYN/kEHHillNzSVN5ShTuPFyUa68OcoViSZz7jkRbtV5KDmZ2hhidT5NU25J5Q0pEINTaNcyXnY/awmAx7e5g6x16SP35utt5bJOSWZKmlIwJvFk/cXyBzios+6BKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=kL+KaXLl; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="kL+KaXLl" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785927815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R4TrMHTQkzwP2lLEW0oUQVcx04oxAW8/FB2AgqPWE68=; b=kL+KaXLlSRmxOZd41Q1d8l4/jqKr/ZYm47f8yzGu5BEqF2e7C/vKuZMbvHXlQuuRSPGY2M J1zxCBSaVEnGrZC13ujg9FxHZbJq54bTXDPFHy9chloV7JQhfuX3/rvWWiKpxzJr7tXl1y JzAC1N9VfGWtT+BtcVWNy9B6T7mYDaM= From: Hongfu Li To: akpm@linux-foundation.org, david@kernel.org, xu.xin16@zte.com.cn, chengming.zhou@linux.dev, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, corbet@lwn.net, skhan@linuxfoundation.org, alexs@kernel.org, si.yanteng@linux.dev, dzm91@hust.edu.cn Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, hongfu.li@linux.dev, Hongfu Li Subject: [PATCH] ksm: update comments and docs to reference folio->mapping Date: Wed, 5 Aug 2026 18:59:07 +0800 Message-ID: <20260805105927.41987-1-hongfu.li@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT From: Hongfu Li The KSM code already stores and checks the stable node key via folio->mapping, but the comment in ksm_get_folio() and the reverse mapping documentation in ksm.rst still refer to page->mapping. This is a pure wording update to match the folio-based implementation. No functional change is intended. Signed-off-by: Hongfu Li Acked-by: David Hildenbrand (Arm) Reviewed-by: Dongliang Mu Reviewed-by: Xu Xin --- Documentation/mm/ksm.rst | 4 ++-- Documentation/translations/zh_CN/mm/ksm.rst | 4 ++-- mm/ksm.c | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Documentation/mm/ksm.rst b/Documentation/mm/ksm.rst index 2806e3e4a10e..2b4f72f1f953 100644 --- a/Documentation/mm/ksm.rst +++ b/Documentation/mm/ksm.rst @@ -24,13 +24,13 @@ tree. =20 If a KSM page is shared between less than ``max_page_sharing`` VMAs, the node of the stable tree that represents such KSM page points to a -list of struct ksm_rmap_item and the ``page->mapping`` of the +list of struct ksm_rmap_item and the ``folio->mapping`` of the KSM page points to the stable tree node. =20 When the sharing passes this threshold, KSM adds a second dimension to the stable tree. The tree node becomes a "chain" that links one or more "dups". Each "dup" keeps reverse mapping information for a KSM -page with ``page->mapping`` pointing to that "dup". +page with ``folio->mapping`` pointing to that "dup". =20 Every "chain" and all "dups" linked into a "chain" enforce the invariant that they represent the same write protected memory content, diff --git a/Documentation/translations/zh_CN/mm/ksm.rst b/Documentation/tr= anslations/zh_CN/mm/ksm.rst index f0f458753d0c..822c7a289671 100644 --- a/Documentation/translations/zh_CN/mm/ksm.rst +++ b/Documentation/translations/zh_CN/mm/ksm.rst @@ -31,10 +31,10 @@ KSM=E7=BB=B4=E6=8A=A4=E7=9D=80=E7=A8=B3=E5=AE=9A=E6=A0= =91=E4=B8=AD=E7=9A=84KSM=E9=A1=B5=E7=9A=84=E9=80=86=E6=98=A0=E5=B0=84=E4=BF= =A1=E6=81=AF=E3=80=82 =20 =E5=BD=93KSM=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=85=B1=E4=BA=AB=E6=95=B0=E5=B0= =8F=E4=BA=8E ``max_page_sharing`` =E7=9A=84=E8=99=9A=E6=8B=9F=E5=86=85=E5= =AD=98=E5=8C=BA=E5=9F=9F(VMAs)=E6=97=B6=EF=BC=8C=E5=88=99=E4=BB=A3=E8=A1=A8= =E4=BA=86 KSM=E9=A1=B5=E7=9A=84=E7=A8=B3=E5=AE=9A=E6=A0=91=E5=85=B6=E4=B8=AD=E7=9A= =84=E8=8A=82=E7=82=B9=E6=8C=87=E5=90=91=E4=BA=86=E4=B8=80=E4=B8=AAksm_rmap_= item=E7=BB=93=E6=9E=84=E4=BD=93=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=97=E8=A1= =A8=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C=E8=BF=99=E4=B8=AAKSM=E9=A1=B5 -=E7=9A=84 ``page->mapping`` =E6=8C=87=E5=90=91=E4=BA=86=E8=AF=A5=E7=A8=B3= =E5=AE=9A=E6=A0=91=E8=8A=82=E7=82=B9=E3=80=82 +=E7=9A=84 ``folio->mapping`` =E6=8C=87=E5=90=91=E4=BA=86=E8=AF=A5=E7=A8=B3= =E5=AE=9A=E6=A0=91=E8=8A=82=E7=82=B9=E3=80=82 =20 =E5=A6=82=E6=9E=9C=E5=85=B1=E4=BA=AB=E6=95=B0=E8=B6=85=E8=BF=87=E4=BA=86= =E9=98=88=E5=80=BC=EF=BC=8CKSM=E5=B0=86=E7=BB=99=E7=A8=B3=E5=AE=9A=E6=A0=91= =E6=B7=BB=E5=8A=A0=E7=AC=AC=E4=BA=8C=E4=B8=AA=E7=BB=B4=E5=BA=A6=E3=80=82=E7= =A8=B3=E5=AE=9A=E6=A0=91=E5=B0=B1=E5=8F=98=E6=88=90=E9=93=BE=E6=8E=A5=E4=B8= =80=E4=B8=AA=E6=88=96=E5=A4=9A -=E4=B8=AA=E7=A8=B3=E5=AE=9A=E6=A0=91"=E5=89=AF=E6=9C=AC"=E7=9A=84"=E9=93= =BE"=E3=80=82=E6=AF=8F=E4=B8=AA=E5=89=AF=E6=9C=AC=E9=83=BD=E4=BF=9D=E7=95= =99KSM=E9=A1=B5=E7=9A=84=E9=80=86=E6=98=A0=E5=B0=84=E4=BF=A1=E6=81=AF=EF=BC= =8C=E5=85=B6=E4=B8=AD ``page->mapping`` +=E4=B8=AA=E7=A8=B3=E5=AE=9A=E6=A0=91"=E5=89=AF=E6=9C=AC"=E7=9A=84"=E9=93= =BE"=E3=80=82=E6=AF=8F=E4=B8=AA=E5=89=AF=E6=9C=AC=E9=83=BD=E4=BF=9D=E7=95= =99KSM=E9=A1=B5=E7=9A=84=E9=80=86=E6=98=A0=E5=B0=84=E4=BF=A1=E6=81=AF=EF=BC= =8C=E5=85=B6=E4=B8=AD ``folio->mapping`` =E6=8C=87=E5=90=91=E8=AF=A5"=E5=89=AF=E6=9C=AC"=E3=80=82 =20 =E6=AF=8F=E4=B8=AA=E9=93=BE=E4=BB=A5=E5=8F=8A=E9=93=BE=E6=8E=A5=E5=88=B0= =E8=AF=A5=E9=93=BE=E4=B8=AD=E7=9A=84=E6=89=80=E6=9C=89"=E5=89=AF=E6=9C=AC"= =E5=BC=BA=E5=88=B6=E4=B8=8D=E5=8F=98=E7=9A=84=E6=98=AF=EF=BC=8C=E5=AE=83=E4= =BB=AC=E4=BB=A3=E8=A1=A8=E4=BA=86=E7=9B=B8=E5=90=8C=E7=9A=84=E5=86=99=E4=BF= =9D=E6=8A=A4=E5=86=85=E5=AD=98 diff --git a/mm/ksm.c b/mm/ksm.c index ab1fc59424e8..4bde9fd8d44e 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -959,10 +959,9 @@ enum ksm_get_folio_flags { * seconds or even minutes: much too unresponsive. So instead we use a * "keyhole reference": access to the ksm page from the stable node peeps * out through its keyhole to see if that page still holds the right key, - * pointing back to this stable node. This relies on freeing a PageAnon - * page to reset its page->mapping to NULL, and relies on no other use of - * a page to put something that might look like our key in page->mapping. - * is on its way to being freed; but it is an anomaly to bear in mind. + * pointing back to this stable node. This relies on freeing an anon + * folio to reset its mapping to NULL, and relies on no other use of a + * folio to put something that might look like our key in its mapping. */ static struct folio *ksm_get_folio(struct ksm_stable_node *stable_node, enum ksm_get_folio_flags flags) --=20 2.54.0