From patchwork Tue Oct 11 02:23:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xu xin X-Patchwork-Id: 13003563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37ECAC433FE for ; Tue, 11 Oct 2022 02:23:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD36E6B0072; Mon, 10 Oct 2022 22:23:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5B4A6B0073; Mon, 10 Oct 2022 22:23:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ADCE8E0001; Mon, 10 Oct 2022 22:23:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 80E5D6B0072 for ; Mon, 10 Oct 2022 22:23:39 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 551E6A046D for ; Tue, 11 Oct 2022 02:23:39 +0000 (UTC) X-FDA: 80007072558.15.050C285 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf19.hostedemail.com (Postfix) with ESMTP id F080E1A0021 for ; Tue, 11 Oct 2022 02:23:38 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id c24so11915113pls.9 for ; Mon, 10 Oct 2022 19:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pA2L/FNaj7e7+kUZGmo87Y5GGtuU8PgqF9oHvyd5XJ0=; b=aOVAgCTFUk3B94yRy18snaZHgtEeSUJykJ0ot+Ljr1hdS5x9wwPdboGW7YMhvDAbRJ ZwvfxbttriYA3H2esaRMMKmVQ0oj9gP02KjMIUTv8viD6oOBtwmpwO/Zmz+LYVUu0dA9 +sF6lCBmK1N0DRiU09vUW/bOP4i8SB9FupMR+m1BQzVXU8kxf29K79Wl1HZWJHmgeKZx oDZWo8snoo2zIPjyDZX96GeLSt4KLsiT/ffMlszxDQI61qJ/iHY8p1guKTIdUMpXoBJa XDqHWaFPlvXmZ2BxY/Iq+yDHZPbPWeLWzwuIc5DzGIUKzmMXwRSjZsNVwgxcB3f6B7Of YUFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pA2L/FNaj7e7+kUZGmo87Y5GGtuU8PgqF9oHvyd5XJ0=; b=6E6KWAK5tVBWGrTOLgLWQo9mL0tEfLmo9LTjiny1/Rs2GPddkZyEI1Hn+AXR+Rx82d V1z0GI//AIvQADw2uyN+KNJEaGdBJn9cS9eCDEKZ6TY8Ng4EoPaL/2XLUb88Gg32ZQr+ ZK/gNXN9ylQVRPKFc2kfT3mFeFZw7pAZT5jZOlb8qwTTY1tWkg2+kfQRh0cEsCEu+qNQ Eieukn33S2OUKl8g+vq67R2/RqiuGGiGHB1WLau8ObJHCefQwyUyLpzkX94oH9zgLqbA Qt/XSG+JrIUgxAPawx6CPdjNL41LaSg1APOKV3BFk4oTxnjdi0NnQw9H6o0+E1jAoO2Q PN8A== X-Gm-Message-State: ACrzQf2P1dmqIuQV2CJJ/wHyeShKT8+L/HAwDrzq2vSHl0WxcgXVW5aH DrB7+k0M4lZU20ODlahgMgc= X-Google-Smtp-Source: AMsMyM6Fv/99kgTYy5VGB7ccfHNOf0+TN7/WFuO0wEJREVgxfoyTXj54YlueWcfwwlxOs9NAHq3MQQ== X-Received: by 2002:a17:90a:ac11:b0:20b:10d2:e837 with SMTP id o17-20020a17090aac1100b0020b10d2e837mr24508899pjq.165.1665455018060; Mon, 10 Oct 2022 19:23:38 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id h2-20020a63f902000000b00438834b14a1sm6801151pgi.80.2022.10.10.19.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 19:23:37 -0700 (PDT) From: xu.xin.sc@gmail.com X-Google-Original-From: xu.xin16@zte.com.cn To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, xu xin , Xiaokai Ran , Yang Yang , Jiang Xuexin , Claudio Imbrenda , David Hildenbrand Subject: [PATCH v3 5/5] ksm: add zero_pages_sharing documentation Date: Tue, 11 Oct 2022 02:23:32 +0000 Message-Id: <20221011022332.322435-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221011022006.322158-1-xu.xin16@zte.com.cn> References: <20221011022006.322158-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665455019; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pA2L/FNaj7e7+kUZGmo87Y5GGtuU8PgqF9oHvyd5XJ0=; b=4ikJ+lpbe+fpY1xJJQA3X3nMb4UW4HYTM9SZJiUv4NgUfHaUmYmrekddC5GDhm7oPUmYNk dZ7wO0ofWgJOPj1ZmXpW5ZaVfoWzfjtmCJPEEqcEP2MHrVoNV922R4j5o5LbYIB0Qj5xeK hN/OFAxnp3k2pIdoF8d3m4sAWMuE2l0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aOVAgCTF; spf=pass (imf19.hostedemail.com: domain of xu.xin.sc@gmail.com designates 209.85.214.194 as permitted sender) smtp.mailfrom=xu.xin.sc@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665455019; a=rsa-sha256; cv=none; b=XSvZlj2A7ba3HNGp3zhxdcoZvyKusCb351OPbT2ffo1j+ktdQDYft68fCJX5yVf9jihwgM T5WT/EwzLZ1V0PbEi07ld9Ux+h+l/E9S0npXXjMlfhlSvHkaLr+CqvrhQc6koN8+MYZUdV hhOrV1jDpIU7/KLWx8DPDM0GJCOhVXs= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aOVAgCTF; spf=pass (imf19.hostedemail.com: domain of xu.xin.sc@gmail.com designates 209.85.214.194 as permitted sender) smtp.mailfrom=xu.xin.sc@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: gj4k4sqyanazxhx9siirjfizwjxrq6or X-Rspamd-Queue-Id: F080E1A0021 X-HE-Tag: 1665455018-603359 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: xu xin When enabling use_zero_pages, pages_sharing cannot represent how much memory saved indeed. zero_pages_sharing + pages_sharing does. add the description of zero_pages_sharing. Cc: Xiaokai Ran Cc: Yang Yang Cc: Jiang Xuexin Cc: Claudio Imbrenda Cc: David Hildenbrand Signed-off-by: xu xin --- Documentation/admin-guide/mm/ksm.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst index fb6ba2002a4b..484665aa7418 100644 --- a/Documentation/admin-guide/mm/ksm.rst +++ b/Documentation/admin-guide/mm/ksm.rst @@ -162,7 +162,7 @@ The effectiveness of KSM and MADV_MERGEABLE is shown in ``/sys/kernel/mm/ksm/``: pages_shared how many shared pages are being used pages_sharing - how many more sites are sharing them i.e. how much saved + how many more sites are sharing them pages_unshared how many pages unique but repeatedly checked for merging pages_volatile @@ -173,6 +173,14 @@ stable_node_chains the number of KSM pages that hit the ``max_page_sharing`` limit stable_node_dups number of duplicated KSM pages +zero_pages_sharing + how many empty pages are sharing kernel zero page(s) instead of + with each other as it would happen normally. Only effective when + enabling ``use_zero_pages`` knob. + +If ``use_zero_pages`` is 0, only ``pages_sharing`` can represents how +much saved. Otherwise, ``pages_sharing`` + ``zero_pages_sharing`` +represents how much saved actually. A high ratio of ``pages_sharing`` to ``pages_shared`` indicates good sharing, but a high ratio of ``pages_unshared`` to ``pages_sharing``