Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17644700rwd; Tue, 27 Jun 2023 06:02:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42+f26NF7jE6kK7PSfDyqRXYtO+dxfmB82oHGy5zEe1MOFS0I5tA5oe/Mur6yDFk+vz8rT X-Received: by 2002:a17:907:6289:b0:987:1df4:f32e with SMTP id nd9-20020a170907628900b009871df4f32emr24674674ejc.28.1687870942859; Tue, 27 Jun 2023 06:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687870942; cv=none; d=google.com; s=arc-20160816; b=EuUw2uvq2CdpZuEW4l/RLikwXuVbXalFuyaad9tUjD+Bml5UJFqSNh0fhZLWEg2TO+ afpBt/XPVNOc4fYtsH6kKfMsomFTZ3E/Se2Vnmfj/XI4d6haNY81oYL1DcOXLAIoZYIE c0yvxlhhkysQGk9JwH949x+NVkPQYUqxdO6IAe2FKFOpE343DlNeeuR4G+HL6ixV+lGr xWgCxQc/jn3v5vd1CC19dFKkrTx2kf3I7s8GgEDb1AODkK4wgaB+QOafZoN0PP0ar9/t AonP7xvC4TbA+R0qkrZPAIK0hdJCe+jVccGEo8a18zk20zk5bFfgv2uRsbwwXw26S0pM HMFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vxjV4IugIs+rtxSqIKdicvXpzmJIyU7mxjVFTv62NqY=; fh=wj8bz++KJxsWzbqnSt5kOxWhnsxnL1FEV7ntRKrcHN4=; b=ac7C1V8LvuGKBF5erTD5aMyqnAjfOHZ4tPX+M3h8gnJ8mxqqdCLDzHee4v4+1yz1/u BfYNTWfeKAv4DgMtG1Re6hmkxCKWIQqu14p6KGAQqsdUGeomprGcM2uzCWsFM+DMIcUQ pmde6pO9QzENNjPyFsnXmcb0SYDqSx7AIWfwkcrqogshe3v23zSNYpFbsSPdDyf6GyFN mKqr0sfiUPSUqgU7J3UiwprdOUjhlLplcRmt/wpAoS7WSYrJ8gTeW2PCz5cIFvvkSw9V wCPeADeF5jcgc+8Qdw/oi8mSFS7fEgOZEbHgP8QULnj10HNUSkNKV0QZLM6OjFpXw9i0 eRng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020a170906125500b00988a4470ecbsi4255205eja.434.2023.06.27.06.01.39; Tue, 27 Jun 2023 06:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbjF0MjF (ORCPT + 99 others); Tue, 27 Jun 2023 08:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjF0MjE (ORCPT ); Tue, 27 Jun 2023 08:39:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95B6726A5 for ; Tue, 27 Jun 2023 05:39:01 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Qr42P74fbzlW0J; Tue, 27 Jun 2023 20:36:13 +0800 (CST) Received: from huawei.com (10.175.113.32) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 27 Jun 2023 20:38:56 +0800 From: Nanyong Sun To: CC: , , , , Subject: [PATCH] mm/ksm: delete the redundant ksm_merging_pages interafce in proc Date: Tue, 27 Jun 2023 21:35:42 +0800 Message-ID: <20230627133542.2446285-1-sunnanyong@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the ksm_merging_pages information already included in /proc//ksm_stat, we can delete /proc//ksm_merging_pages to make the directory more clean, and can save a little bit resources. Signed-off-by: Nanyong Sun --- Documentation/admin-guide/mm/ksm.rst | 6 +++--- .../translations/zh_CN/admin-guide/mm/ksm.rst | 4 ++-- fs/proc/base.c | 15 --------------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst index 7626392fe82c..e668d4b5e800 100644 --- a/Documentation/admin-guide/mm/ksm.rst +++ b/Documentation/admin-guide/mm/ksm.rst @@ -208,9 +208,9 @@ several times, which are unprofitable memory consumed. process_profit =~ ksm_merging_pages * sizeof(page) - ksm_rmap_items * sizeof(rmap_item). - where ksm_merging_pages is shown under the directory ``/proc//``, - and ksm_rmap_items is shown in ``/proc//ksm_stat``. The process profit - is also shown in ``/proc//ksm_stat`` as ksm_process_profit. + where ksm_merging_pages and ksm_rmap_items is shown in the file + ``/proc//ksm_stat``. The process profit is also shown in + ``/proc//ksm_stat`` as ksm_process_profit. From the perspective of application, a high ratio of ``ksm_rmap_items`` to ``ksm_merging_pages`` means a bad madvise-applied policy, so developers or diff --git a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst index 0029c4fd2201..1662f271efc8 100644 --- a/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst +++ b/Documentation/translations/zh_CN/admin-guide/mm/ksm.rst @@ -167,8 +167,8 @@ KSM可以通过合并相同的页面来节省内存,但也会消耗额外的 process_profit =~ ksm_merging_pages * sizeof(page) - ksm_rmap_items * sizeof(rmap_item). - 其中ksm_merging_pages显示在 ``/proc//`` 目录下,而ksm_rmap_items - 显示在 ``/proc//ksm_stat`` 。 + 其中ksm_merging_pages、ksm_rmap_items显示在 ``/proc//ksm_stat`` 文件中,收益 + 值ksm_process_profit也显示在该文件中。 从应用的角度来看, ``ksm_rmap_items`` 和 ``ksm_merging_pages`` 的高比例意 味着不好的madvise-applied策略,所以开发者或管理员必须重新考虑如何改变madvis策 diff --git a/fs/proc/base.c b/fs/proc/base.c index 05452c3b9872..173261dbeaea 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3186,19 +3186,6 @@ static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, #endif /* CONFIG_LIVEPATCH */ #ifdef CONFIG_KSM -static int proc_pid_ksm_merging_pages(struct seq_file *m, struct pid_namespace *ns, - struct pid *pid, struct task_struct *task) -{ - struct mm_struct *mm; - - mm = get_task_mm(task); - if (mm) { - seq_printf(m, "%lu\n", mm->ksm_merging_pages); - mmput(mm); - } - - return 0; -} static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { @@ -3348,7 +3335,6 @@ static const struct pid_entry tgid_base_stuff[] = { ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache), #endif #ifdef CONFIG_KSM - ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages), ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat), #endif }; @@ -3686,7 +3672,6 @@ static const struct pid_entry tid_base_stuff[] = { ONE("seccomp_cache", S_IRUSR, proc_pid_seccomp_cache), #endif #ifdef CONFIG_KSM - ONE("ksm_merging_pages", S_IRUSR, proc_pid_ksm_merging_pages), ONE("ksm_stat", S_IRUSR, proc_pid_ksm_stat), #endif }; -- 2.25.1