Message ID | 20230706094917.588213-1-sunnanyong@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2441129vqx; Thu, 6 Jul 2023 03:02:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlFvJWUzDaqisBeNWJZecIswIHrg1z2FX7HIGVi3gkSCEWpPGd7PwCKl9Bgb1R4GZe0n90W6 X-Received: by 2002:a17:90b:2302:b0:263:5637:abf8 with SMTP id mt2-20020a17090b230200b002635637abf8mr855793pjb.13.1688637752533; Thu, 06 Jul 2023 03:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688637752; cv=none; d=google.com; s=arc-20160816; b=jgVRK3ChkKXN82i+V2iP6ZeYvomCfKmC5xjYleO/RrrrUpPLm/8ticJ8SxuIP3RSIA 2ELWBrwPyMjndZe5BPau0bLVcNz/FcNTuKjPx0z9YrCdfd4yS+VDJoHKjbvmaYobG9FY yXMSfCGnAeZ5P3Gv5h05vKhzq2kiCX8mmhG9t4khHP/v/Wz6FCZktjFCsmOFBJy9Xquv mliNPad8bawZjWuVdCPU6C0LrrJLt4AZ4zA5jQGSt8nPgOjti9gg7/i7u6oZiSQ5vNpP 5G6h/aczB/K4HgvlJzun9Zv6zdNbqzeGGuNNmmd6PQukBtUUlOVFJ+uD1KjprGA5UYi8 +K/Q== 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=5HQ1VixHcTDZf83zBDXVwXn2oods3bqKlLdcm+RhqhM=; fh=FbLC4Ipg/dlQPhFDGtb5qsYawPuPj/2Oa8o+izWyJPk=; b=xdvyZdeY6X79qfe4Z+1rogT/tIsSgdW754fMnm2K/A0R697XxXI/A9BF6jT2jP46xD Zr4q2pVU8764tsOOpWoDQ49GPlB/Nrb7mzAW6/nvXxAK+U7lpBsXDAV6Mto2B3QVGpfZ imb969gz9+1pmiQ3/zjYybCvbw5k0P1nlmPdD5Gz4OWECtAmF3dAo68KWDCIfNLjM7pn K0W3TsCxwPGLiWqWwQkiwg6enYV4vTFIMezq5fZh3s4EBQu/dhRXG9z+Rhp7DzR0x4wd eT+Zdc9nx9MUM1KLzqg+CmqHgaSJjsU7r/K6n64XYdxd2r2VP0xN/JDwfJLSWz393Uwt mB1g== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a635807000000b00553ad455581si1172269pgb.296.2023.07.06.03.02.10; Thu, 06 Jul 2023 03:02:32 -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 S231546AbjGFIxB (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 04:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231466AbjGFIw7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 04:52:59 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3395E1BE1 for <linux-kernel@vger.kernel.org>; Thu, 6 Jul 2023 01:52:55 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QxVf232rWz1HCxm; Thu, 6 Jul 2023 16:52:26 +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; Thu, 6 Jul 2023 16:52:52 +0800 From: Nanyong Sun <sunnanyong@huawei.com> To: <akpm@linux-foundation.org> CC: <xu.xin16@zte.com.cn>, <david@redhat.com>, <wangkefeng.wang@huawei.com>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <sunnanyong@huawei.com> Subject: [PATCH] mm/ksm: prepare to remove the redundant ksm_merging_pages in procfs Date: Thu, 6 Jul 2023 17:49:17 +0800 Message-ID: <20230706094917.588213-1-sunnanyong@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770661952917895730?= X-GMAIL-MSGID: =?utf-8?q?1770665019902336851?= |
Series |
mm/ksm: prepare to remove the redundant ksm_merging_pages in procfs
|
|
Commit Message
Nanyong Sun
July 6, 2023, 9:49 a.m. UTC
Since the ksm_merging_pages information already included in
/proc/<pid>/ksm_stat, we could remove /proc/<pid>/ksm_merging_pages
to make the directory more clean, and can save a little bit resources.
To delete this interface more smoothly and avoid userspace break,
retain this interface temporarily and modify its function to hint
users to use ksm_stat instead.
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
---
fs/proc/base.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
Comments
On 2023/7/6 16:55, David Hildenbrand wrote: > On 06.07.23 11:49, Nanyong Sun wrote: >> Since the ksm_merging_pages information already included in >> /proc/<pid>/ksm_stat, we could remove /proc/<pid>/ksm_merging_pages >> to make the directory more clean, and can save a little bit resources. >> >> To delete this interface more smoothly and avoid userspace break, >> retain this interface temporarily and modify its function to hint >> users to use ksm_stat instead. >> >> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com> >> --- >> fs/proc/base.c | 9 +-------- >> 1 file changed, 1 insertion(+), 8 deletions(-) >> >> diff --git a/fs/proc/base.c b/fs/proc/base.c >> index eb2e498e3b8d..d080c58cbe6c 100644 >> --- a/fs/proc/base.c >> +++ b/fs/proc/base.c >> @@ -3189,14 +3189,7 @@ static int proc_pid_patch_state(struct >> seq_file *m, struct pid_namespace *ns, >> 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); >> - } >> - >> + seq_puts(m, "please use /proc/<pid>/ksm_stat instead\n"); >> return 0; >> } >> static int proc_pid_ksm_stat(struct seq_file *m, struct >> pid_namespace *ns, > > > Why do we care so much about removing 15 simple LOC? That change here > will already mess with user space. > > Sorry, but IMHO it's all not worth the churn. > We do not pay attention to these 15 LOC. We pay more attention to the redundant interface under procfs. This interface is used by developers and has a short history. Therefore, changing it now has no big impact.
On 06.07.23 13:59, Nanyong Sun wrote: > On 2023/7/6 16:55, David Hildenbrand wrote: > >> On 06.07.23 11:49, Nanyong Sun wrote: >>> Since the ksm_merging_pages information already included in >>> /proc/<pid>/ksm_stat, we could remove /proc/<pid>/ksm_merging_pages >>> to make the directory more clean, and can save a little bit resources. >>> >>> To delete this interface more smoothly and avoid userspace break, >>> retain this interface temporarily and modify its function to hint >>> users to use ksm_stat instead. >>> >>> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com> >>> --- >>> fs/proc/base.c | 9 +-------- >>> 1 file changed, 1 insertion(+), 8 deletions(-) >>> >>> diff --git a/fs/proc/base.c b/fs/proc/base.c >>> index eb2e498e3b8d..d080c58cbe6c 100644 >>> --- a/fs/proc/base.c >>> +++ b/fs/proc/base.c >>> @@ -3189,14 +3189,7 @@ static int proc_pid_patch_state(struct >>> seq_file *m, struct pid_namespace *ns, >>> 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); >>> - } >>> - >>> + seq_puts(m, "please use /proc/<pid>/ksm_stat instead\n"); >>> return 0; >>> } >>> static int proc_pid_ksm_stat(struct seq_file *m, struct >>> pid_namespace *ns, >> >> >> Why do we care so much about removing 15 simple LOC? That change here >> will already mess with user space. >> >> Sorry, but IMHO it's all not worth the churn. >> > We do not pay attention to these 15 LOC. We pay more attention to the > redundant interface under procfs. > > This interface is used by developers and has a short history. Therefore, > changing it now has no big impact. > Again, already 1 year old. And returning garbage instead of ripping it out might be even nastier.
diff --git a/fs/proc/base.c b/fs/proc/base.c index eb2e498e3b8d..d080c58cbe6c 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3189,14 +3189,7 @@ static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, 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); - } - + seq_puts(m, "please use /proc/<pid>/ksm_stat instead\n"); return 0; } static int proc_pid_ksm_stat(struct seq_file *m, struct pid_namespace *ns,