From patchwork Tue Jun 27 13:35:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nanyong Sun X-Patchwork-Id: 13294423 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 DDFC4EB64DC for ; Tue, 27 Jun 2023 12:39:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B74D8D0002; Tue, 27 Jun 2023 08:39:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 567798D0001; Tue, 27 Jun 2023 08:39:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42F168D0002; Tue, 27 Jun 2023 08:39:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 305488D0001 for ; Tue, 27 Jun 2023 08:39:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DFF31B0156 for ; Tue, 27 Jun 2023 12:39:11 +0000 (UTC) X-FDA: 80948482902.04.BF61F7F Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf20.hostedemail.com (Postfix) with ESMTP id 630D81C000D for ; Tue, 27 Jun 2023 12:39:07 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of sunnanyong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=sunnanyong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687869549; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=vxjV4IugIs+rtxSqIKdicvXpzmJIyU7mxjVFTv62NqY=; b=kX5VfA9crF9ma+4SKD/zOlBhl4AgAhxXmBc8orY0Uq0jC4rIX3IaCSic0W7Ap11VC5oJsa KCOJMVvBozmtVb2a0i4zN7ybQgigXUgIpJSujjsUSz1tDW6aJBQwisT2ac0lh24nuWKPa3 dA/66YzzSaGNHKdp9gYBmTG2e2QXcmQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687869549; a=rsa-sha256; cv=none; b=XR6KkhvsuJ+KOYlecS210noXdiWU26786E6TKQ8jWfT7Ff0IRwOvF5X+Vs6TjthN25km2J P0UrCKELmygO/5G9xH9ddfkju7ojy7SU5xzNK9IUwnHgmA/+ZC2ZDImyCaHGXUQYBlfdEq d/4/DL5KQhkVjK3X5CEXRP8oNjQyTkk= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of sunnanyong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=sunnanyong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com 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 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-Stat-Signature: rjwgixtczqj5nxxer5hmzcq1dugxn58g X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 630D81C000D X-Rspam-User: X-HE-Tag: 1687869547-846050 X-HE-Meta: U2FsdGVkX19dxlnmHw491w3HSvANkobZe1GGgStiQSPZpHzb2OO0dogBZcGVxBU4PwrKmlxj/+37DTqgsTb/M6aaOcFxB10Av3dZRwYi4ptqgg4/4GYDCKKK9mpLNaK4vzlCf8zUcC/jhmDgGLotayIse2AgRFh5r+7zgzdJ+1FVYyFFa1sreWMYOsKuasjjpbOszS8oOZHiXDxat1WUmOq5cw/IMeUgNr+p0VfqfFiFRiTYkdvr5MUhifVKO4hPGVTn6Qpf+byPzpDNhoe2BRxyADFsc+gEO7XBJ9t3CzTl5cNHlb4puRmqwRbsdBt/47CCeetXlXJDqGLZ0fLZdSCuQ2m4Mdg6XuvyfWiuw1llkHIEyiwcEmh/z70V+/qFdQ+r4+l7mBAWKa8crAJ7iZ01lMJUCBcLkiWEu14vLyyPBadiMpRJbEm+5+dpX219JoO+dWd73amT9RxcBBjM7GUzwohnBUkRHsFEzud9oFpdEqskjmON9JLQWGfwK0G3drWzmgeUR2NaRJkcli/uJR2dzSudS5FYnoEV9OOf1owyA0XqktrrkETGoJBhMlkD1t6TEfI2C+5qQwx5/S5CE1s5T81l42/F7LLXC9qBWyDs+RwKKTEIgpPHp4ISaT7luZsZbNcm99b39LIbZd7oDXrB0e/GZEYrhAaeIgb6azDniYYpaZfNAcnpM/sKhBWkhxAuVKtdCS7rmC6+CLt5Wi6mfHVGupHb0tO+aaVPvnpFlBGypTghX+y5TFPBkLY3Tje1Es6P6MCZD5BbS97PgaxtHePmDTfe/v15kTjHbbYIUy9vZOKn10yB7v/eHqaLAra2XD+/o68+s9vdAnGeFCjsF50erEWDUu1H1tkeIXdC5T/q9IxZJ2DsI9sOIlg/Lh9Z72V7pGzQAlpFdE1C3tPvhZt96TSFklTcNWAaLuxYJOScT38DVtv9961/KfQNf9X4o9Hl+i7pAKWACzQ zN8Xby9n FXcFSH4fSJFU43So/9NQFk6tXLtyfwJzJ3VfulslruY9FwEUar2u9aIgpnKGLKm/qj6mHT/iOTXO/SoTqXSquG/nhHI7/PU4vNFZmrtmUnRPEnnaba/PMCWt05zPKjHG9S76bl9zvnv4hlJmkWqsa+JWC+TvqX64P4g2/xKmej7zOtGV9323QMg5Y8h30363Z/ckvBpSxC4c9rq7uIRuKC2gNFVTdRXOb5cCOIIS9/g5N6uY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 };