Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18610455rwd; Tue, 27 Jun 2023 20:59:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Lq2JUOouxL7JtqUKI/B6DGw4q4gYno95z0mZiV4fh3z9Z3iqYgGHYlHeRFcBwpuVq7AcD X-Received: by 2002:a17:907:3d92:b0:98e:1c4b:10bb with SMTP id he18-20020a1709073d9200b0098e1c4b10bbmr9434726ejc.35.1687924773837; Tue, 27 Jun 2023 20:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687924773; cv=none; d=google.com; s=arc-20160816; b=PZ59/4oySsQTIJ9aby8k9rv9VD9LkLK0E4YONb39UObEMHFeYUK2qrP2gZ5oZl66RD UOJaM0M5ojjQLj4x5PnmeYlX/G4V8uIpMahAdv6xWUjNDlzUDS7EkEZCmUW37G71Ae8K qDKlSqOXi/Nw8cTZqvhGbvHef0jHdZAKPZn6eEqCLIIS11MfDY9qK2mFyc/s8g1Ydpkx NpPgXxisgTaIzE08Rc6U/igrVK2oHfh3/bm4L/urF04L8l6/UWTSkrYVRfZUwYXpWziO ZopMCsHgYODaasRwifC480Y/PtTsC7SL9SoJvBOOP+BTpxgjraHAfprw0zvGAXLMDP5G I0uw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rQFnqlRY9Ayf2Ahh0aPEKPTmp8m8k9EoLrFDTq688fk=; fh=QvzbxnMFLCU+kh7pQIxiE9dC+XbAGB2TuRIXkx0m7vQ=; b=oQOPphVygQDwP+mpCt/G7JGwm79hHgzfGRa1y5aniwVxGcGwpLTnubiZA4wGYD0G7s jfH1OymROFCufmERVuFumAr2ChLgM/E46tfGVjIQLpPt34HieVFiq/PpLTWNCsdaD7U1 DCVsln1uaVlTKQmjRrevKSBWPCEr+4bBm08c0Fa3dP6xxKAVfKzlqMBwBwiTxV0atPLE 2UzGnLX1WxD2HKfa/jWQFUxakd2Bla9zTdSPLHIRi/ZjqtYCOSJ9xBKPks3BbAFY+MXk 1yK7hnR4juyfVaVqzSh6bFKnbNogYOiakUcMXH01Qek24t3yE8tuJmp6mm+obFOqBGma kfGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IBuDEKo0; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj25-20020a170906d79900b00991cc9224c1si3084970ejb.379.2023.06.27.20.59.01; Tue, 27 Jun 2023 20:59:33 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IBuDEKo0; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbjF1DMs (ORCPT + 99 others); Tue, 27 Jun 2023 23:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbjF1DMq (ORCPT ); Tue, 27 Jun 2023 23:12:46 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F1E1FCD for ; Tue, 27 Jun 2023 20:12:45 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id af79cd13be357-7672303c831so2180485a.2 for ; Tue, 27 Jun 2023 20:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687921964; x=1690513964; 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=rQFnqlRY9Ayf2Ahh0aPEKPTmp8m8k9EoLrFDTq688fk=; b=IBuDEKo0D1Uh11I4ooWMUIDiV8ZzO5Flc5tZkjkJkAKLGU/yzN2xTfWq63KS1o7r0C PDBN8XAN2S6t4ZZmiSPsrocNwTbK8+a46yK+DILkAEaTO31rtUtlV9s93UsXx3tf6jvA /QMtM8Fr8g90GmrLAV5k/Ix8jcVx33aokTC0jgEncoMNL72bDrqtLRMqONKXZAqW1H5C L8FSSXmdrIu2znrR8gLKexhUwr28BxhONrTuqCTtofMcvKrhk2/NH3dyAxRDll3nU8+5 UPl7ldCVr5htvDi/xyupH8Pzlbv21uRekyRTSQLqGiCPm6sSsu7rYW70fVA2NU1kDyQR oADw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687921964; x=1690513964; 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=rQFnqlRY9Ayf2Ahh0aPEKPTmp8m8k9EoLrFDTq688fk=; b=MsuyF8tgWZAOtwGx6kw1Z8Z1eli/q4SXsJjRqdUYzlfvgKPGYwUL8Df/USiNLkj651 mUPeeaWvFzq2ZTBaBmnPw91rKfrr3aDO4wY8c6y+D17JENJ/SvBkPd+OvmPoPGfiZ1xN hjgA9Ku8FI9r2oGhSBhtRZ8sgTuxCpqweXztkn9b4DhxPITuvbHQeKhdtx9WxWekDGCR 51yCnauOnc7EhHbxo+nLsXG8Tu24ncbqMjPHkIqLkn2xkBCR1azmNd/yNdWBq5eusxCk hjFs4cLiwyh9PdZpYgyPD8odDC6jBp3ipScDf43QajBW5OKc+sa5hwhABg/mTp0g+4bM qG1Q== X-Gm-Message-State: AC+VfDxafbWrKT+GvSVGJ/pb5GnXZWTBS7AGnl4MhBdbQZyRweQpB85B 20C57WMGo7heqiH5VQ+TSX8= X-Received: by 2002:a05:620a:444f:b0:765:ad28:2c6f with SMTP id w15-20020a05620a444f00b00765ad282c6fmr9514662qkp.20.1687921964006; Tue, 27 Jun 2023 20:12:44 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id oj3-20020a17090b4d8300b0024e4f169931sm8574690pjb.2.2023.06.27.20.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 20:12:43 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: sunnanyong@huawei.com Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, wangkefeng.wang@huawei.com, yang.yang29@zte.com.cn, xu.xin16@zte.com.cn Subject: Re: [PATCH] mm/ksm: delete the redundant ksm_merging_pages interafce in proc Date: Wed, 28 Jun 2023 11:12:33 +0800 Message-Id: <20230628031233.9734-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230627133542.2446285-1-sunnanyong@huawei.com> References: <20230627133542.2446285-1-sunnanyong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 > Message-ID: <20230627133542.2446285-1-sunnanyong@huawei.com> (raw) > > 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. I think it's ok to remove it because this interface was not proposed for a long time. I believe its users are not many yet. The earlier we delete it, the better. The patch is good except some grammar issues. Reviewed-by: xu xin > /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 is -> are > + ``/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