Skip to contentSkip to conversation

ksm: update comments and docs to reference folio->mapping

PATCH Applied Hongfu Li 4 participants 4 messages Aug 5

Subsystems (5)
lore
Share & tools
lore

Hongfu Li

author
#0 lore raw

PATCH 1/1 ksm: update comments and docs to reference folio->mapping

From: Hongfu Li <[email protected]>

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.

---
 Documentation/mm/ksm.rst                    | 4 ++--
 Documentation/translations/zh_CN/mm/ksm.rst | 4 ++--
 mm/ksm.c                                    | 7 +++----
 3 files changed, 7 insertions(+), 8 deletions(-)
Documentation/mm/ksm.rst +2 -2
index 2806e3e4a10e..2b4f72f1f953 100644
@@ -24,13 +24,13 @@ tree.
 
 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.
 
 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".
 
 Every "chain" and all "dups" linked into a "chain" enforce the
 invariant that they represent the same write protected memory content,
Documentation/translations/zh_CN/mm/ksm.rst +2 -2
index f0f458753d0c..822c7a289671 100644
@@ -31,10 +31,10 @@ KSM维护着稳定树中的KSM页的逆映射信息。
 
 当KSM页面的共享数小于 ``max_page_sharing`` 的虚拟内存区域(VMAs)时,则代表了
 KSM页的稳定树其中的节点指向了一个ksm_rmap_item结构体类型的列表。同时,这个KSM页
-的 ``page->mapping`` 指向了该稳定树节点。
+的 ``folio->mapping`` 指向了该稳定树节点。
 
 如果共享数超过了阈值,KSM将给稳定树添加第二个维度。稳定树就变成链接一个或多
-个稳定树"副本"的"链"。每个副本都保留KSM页的逆映射信息,其中 ``page->mapping``
+个稳定树"副本"的"链"。每个副本都保留KSM页的逆映射信息,其中 ``folio->mapping``
 指向该"副本"。
 
 每个链以及链接到该链中的所有"副本"强制不变的是,它们代表了相同的写保护内存
mm/ksm.c +3 -4
index ab1fc59424e8..4bde9fd8d44e 100644
@@ -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)
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hongfu Li

From: Hongfu Li <[email protected]>

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.

---

No idea about the Chinese stuff, but looks correct.

Signature · 3 lines
Cheers,

David
Reviewed-by on v1 1/1
#2 lore raw
In reply to Hongfu Li
Quoted 7 lines

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.

Quoted 6 lines

---

Documentation/mm/ksm.rst                    | 4 ++--
Documentation/translations/zh_CN/mm/ksm.rst | 4 ++--
mm/ksm.c                                    | 7 +++----
3 files changed, 7 insertions(+), 8 deletions(-)
reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Hongfu Li
Quoted 41 lines · Hongfu Li

From: Hongfu Li <[email protected]>

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.

---
  Documentation/mm/ksm.rst                    | 4 ++--
  Documentation/translations/zh_CN/mm/ksm.rst | 4 ++--
  mm/ksm.c                                    | 7 +++----
  3 files changed, 7 insertions(+), 8 deletions(-)
Documentation/mm/ksm.rst +2 -2
index 2806e3e4a10e..2b4f72f1f953 100644
@@ -24,13 +24,13 @@ tree.
 
  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.
 
  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".
 
  Every "chain" and all "dups" linked into a "chain" enforce the
  invariant that they represent the same write protected memory content,
Documentation/translations/zh_CN/mm/ksm.rst +0 -0
index f0f458753d0c..822c7a289671 100644

Documentation/translations/zh_CN/mm/ksm.rst KSM维护着稳定树中的KSM页的逆映射信息。 · line 38

Quoted 10 lines
Documentation/translations/zh_CN/mm/ksm.rst +2 -2
@@ -31,10 +31,10 @@ KSM维护着稳定树中的KSM页的逆映射信息。
 
  当KSM页面的共享数小于 ``max_page_sharing`` 的虚拟内存区域(VMAs)时,则代表了
  KSM页的稳定树其中的节点指向了一个ksm_rmap_item结构体类型的列表。同时,这个KSM页
-的 ``page->mapping`` 指向了该稳定树节点。
+的 ``folio->mapping`` 指向了该稳定树节点。
 
  如果共享数超过了阈值,KSM将给稳定树添加第二个维度。稳定树就变成链接一个或多
-个稳定树"副本"的"链"。每个副本都保留KSM页的逆映射信息,其中 ``page->mapping``
+个稳定树"副本"的"链"。每个副本都保留KSM页的逆映射信息,其中 ``folio->mapping``
  指向该"副本"。

The Chinese translation looks good to me.

Quoted 20 lines
Documentation/translations/zh_CN/mm/ksm.rst +0 -0
  每个链以及链接到该链中的所有"副本"强制不变的是,它们代表了相同的写保护内存
mm/ksm.c +3 -4
index ab1fc59424e8..4bde9fd8d44e 100644
@@ -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)