Message ID | 20240219031911.10372-3-fangzheng.zhang@unisoc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1058598dyc; Sun, 18 Feb 2024 19:20:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJvYiXS8sLcecHTDgHDq6jgX9uT8Ittx6rN+MdZlVOXz/6Q9taQeLbUL7wXQYDo8H8xkNGV58ZhfaXrE3ILGKpKZVxyA== X-Google-Smtp-Source: AGHT+IGcTdpXdYxR44HmoyWqy8xSra6L34Tb2laKPT+di057SlpxxK/QgodMC7VBNTQxu7SYm8PH X-Received: by 2002:a17:90a:c706:b0:296:f874:6844 with SMTP id o6-20020a17090ac70600b00296f8746844mr9332494pjt.15.1708312850460; Sun, 18 Feb 2024 19:20:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708312850; cv=pass; d=google.com; s=arc-20160816; b=npHMW/dgnE01mhrTCQY4W4MDYY98l4pP74WobwoGTQYpGGzXudJhWwCqu2dQ3hEdad 7ks4kAKylzSOPFfjRetqdmCKVHiNoZmT1ecB+Y8+ItPeYGOjr8Jpbq5Te0WwBpu6eu08 HVCGbwRoNM/WrcFzDqFSUysn2NsU/uy3MQfmBush1gZyKwwNbGKfLyG5mNl40IxxhCst KmS43RfVYb+IuTQtDWo47jYFn5OrUlkttGGjABLr5A9iH1oJ1goM/uTIlGBNWHbcUJfk FsHKjv4OtG5yslISKUgiIgWYvmxj9idfgC3JaMaLXTuNXQJn8LzdhEYh8+qwOn7cfJS7 PVzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9vyRfTNG4hqy1ChcWYAwxL2sBvFByiWsigWbOQ6K1BI=; fh=zPkfwF/RKpjXAd+6FOo7GH5tFJ5Aa5Jc4zvtPw/XAZc=; b=YkV1yCbJkC9NDMo8yyVoYDc2nNch2pJuEXmtJzzxp57kF7ssxxDwyLJAZs1Xzbqjnm 3kpaSmEChakXlVdLHWLhzWWJlEe04ND32KnudFvNEdpfWhBDe3oYSdd99Z5uxlgTsWS6 bPytWtgDvlXdfw3cfIQoIkyZJBBCMJabOtL+b/bKHUzEQPoeQhRhXj0S6Dr27eliQxzx doGWmwd8spnYl8UA4GUBFaj/n6pcyrSRkHIMLamBDGh9qMekoSIqhcBkd64Th9dkhPdE 2cezOhc21EMcM2MWDBhNheODHZ0Ojd6+kwnT4udT28hRQcutJg5tbl6AGu8Qk0tvhvI8 mfeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gq6-20020a17090b104600b002995f0ef92asi2958083pjb.111.2024.02.18.19.20.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 19:20:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70673-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 42D14281793 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 03:20:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26FD15673; Mon, 19 Feb 2024 03:20:36 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C237C4C90 for <linux-kernel@vger.kernel.org>; Mon, 19 Feb 2024 03:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708312834; cv=none; b=U+9gBxPChz/YwQBnh0SEsLCLiH40ZisZA3a7cx4qtIcOjzTK6mMqaQge8MgnNMRt8Nq4OeukJDzuChGZBpg6tBKZigzSLCjXwGkJ1J1compb/6rRiVEDRRWxM93soeipOjjdtyYMr2KxF3mQR9whHKiEcg39TtU6KchLJ8qToSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708312834; c=relaxed/simple; bh=qZ3QP/O+dKCUtJMzLtIoEE1u0enCWJg3RGRx2cIFbdQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pXWjJHk99R8Do9KTjwACro26QqEJ12WAPdfHkvc35XHZu/QdcQsyI+j7AVT9YUSPv76PEb3WoCU9IorPK+2zP3e/qqjDTm5PbRoOTvW4/qH+J3Rki4Gm9EMgHopwg5NeAfSplvLSI85C6NKVLHzfjMoz3YxJ+mbPsKNWo10cF+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 41J3KDic006816; Mon, 19 Feb 2024 11:20:13 +0800 (+08) (envelope-from fangzheng.zhang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx02.spreadtrum.com [10.0.64.8]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4TdSSt0CC8z2KDdHY; Mon, 19 Feb 2024 11:19:42 +0800 (CST) Received: from bj10906pcu1.spreadtrum.com (10.0.73.72) by BJMBX02.spreadtrum.com (10.0.64.8) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 19 Feb 2024 11:20:10 +0800 From: Fangzheng Zhang <fangzheng.zhang@unisoc.com> To: Christoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Andrew Morton <akpm@linux-foundation.org>, Vlastimil Babka <vbabka@suse.cz>, Roman Gushchin <roman.gushchin@linux.dev>, Hyeonggon Yoo <42.hyeyoo@gmail.com>, Greg KH <gregkh@linuxfoundation.org> CC: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <tkjos@google.com>, Fangzheng Zhang <fangzheng.zhang@unisoc.com>, Fangzheng Zhang <fangzheng.zhang1003@gmail.com>, Yuming Han <yuming.han@unisoc.com>, Chunyan Zhang <zhang.lyra@gmail.com> Subject: [PATCH V2 2/2] Documentation: filesystems: introduce proc/slabinfo to users Date: Mon, 19 Feb 2024 11:19:11 +0800 Message-ID: <20240219031911.10372-3-fangzheng.zhang@unisoc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240219031911.10372-1-fangzheng.zhang@unisoc.com> References: <20240219031911.10372-1-fangzheng.zhang@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com 41J3KDic006816 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791295855631514516 X-GMAIL-MSGID: 1791295855631514516 |
Series |
Introduce slabinfo version 2.2
|
|
Commit Message
Fangzheng Zhang
Feb. 19, 2024, 3:19 a.m. UTC
Supplement slabinfo-version 2.2 details in proc.rst, so that
users can have the status of slabinfo at a glance. And mark
the optimization work that will be performed on proc/slabinfo
in the next step.
Signed-off-by: Fangzheng Zhang <fangzheng.zhang@unisoc.com>
---
Documentation/filesystems/proc.rst | 33 ++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
Comments
On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: > +Note, <slabreclaim> comes from the collected results in the file > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo > +as deprecated and recommend the use of either sysfs directly or > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. Wait, so you're going to all of the trouble of changing the format of slabinfo (with the associated costs of updating every tool that currently parses it), only to recommend that we stop using it and start using tools/mm/slabinfo instead? How about we simply do nothing?
On Mon, Feb 19, 2024 at 12:24 PM Matthew Wilcox <willy@infradead.org> wrote: > > On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: > > +Note, <slabreclaim> comes from the collected results in the file > > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo > > +as deprecated and recommend the use of either sysfs directly or > > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. > > Wait, so you're going to all of the trouble of changing the format of > slabinfo (with the associated costs of updating every tool that currently > parses it), only to recommend that we stop using it and start using > tools/mm/slabinfo instead? > The initial purpose was to obtain the type of each slab through a simple command 'cat proc/slabinfo'. So here, my intention is not to update all slabinfo-related tools for the time being, but to modify the version number of proc/slabinfo and further display the results of using the command. > How about we simply do nothing? The note here means what changes will occur after we modify the version number of proc/slabinfo to 2.2. As for the replacement of tools/mm/slabinfo (that inspired by Christoph’s suggestions), it will be implemented in the next version or even the later version. Thanks!
On 2/19/24 07:23, zhang fangzheng wrote: > On Mon, Feb 19, 2024 at 12:24 PM Matthew Wilcox <willy@infradead.org> wrote: >> >> On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: >> > +Note, <slabreclaim> comes from the collected results in the file >> > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo >> > +as deprecated and recommend the use of either sysfs directly or >> > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. >> >> Wait, so you're going to all of the trouble of changing the format of >> slabinfo (with the associated costs of updating every tool that currently >> parses it), only to recommend that we stop using it and start using >> tools/mm/slabinfo instead? >> Hi, > The initial purpose was to obtain the type of each slab through > a simple command 'cat proc/slabinfo'. So here, my intention is not to > update all slabinfo-related tools for the time being, but to modify > the version number of proc/slabinfo and further display the results > of using the command. I'm not sure you understand the concern. There are existing consumers of /proc/slabinfo, that might become broken by patch 1/2. We don't even know them all, they might not be all opensource etc. So we can't even make sure all of them are updated. What can happen after patch 1/2: - they keep working and ignore the new column (good) - they include a version check and notice a new unsupported version and refuse to work - confused by the new column they start throwing error, or report wrong stats (that's worse) >> How about we simply do nothing? Agreed wrt modifying /proc/slabinfo > The note here means what changes will occur after > we modify the version number of proc/slabinfo to 2.2. > As for the replacement of tools/mm/slabinfo (that inspired > by Christoph’s suggestions), it will be implemented in the next version > or even the later version. So what is your motivation for all this in the first place? You have some monitoring tool that relies on /proc/slabinfo and want to distinguish reclaimable caches? So you can change it to parse the /sys directories. Is it more work? Yes, but you only have to do that once per boot, because unlike the object/memory stats in /proc/slabinfo, the reclaimable flag will not change for a cache. Would tools/mm/slabinfo almost work for you, but you're missing something? Then send patches for that in the first place. Changing /proc/slabinfo (and breaking other consumers) for a quick and easy fix with a different solution planned for the future is simply not feasible. HTH, Vlastimil > Thanks!
On Mon, Feb 19, 2024 at 4:09 PM Vlastimil Babka <vbabka@suse.cz> wrote: > > On 2/19/24 07:23, zhang fangzheng wrote: > > On Mon, Feb 19, 2024 at 12:24 PM Matthew Wilcox <willy@infradead.org> wrote: > >> > >> On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: > >> > +Note, <slabreclaim> comes from the collected results in the file > >> > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo > >> > +as deprecated and recommend the use of either sysfs directly or > >> > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. > >> > >> Wait, so you're going to all of the trouble of changing the format of > >> slabinfo (with the associated costs of updating every tool that currently > >> parses it), only to recommend that we stop using it and start using > >> tools/mm/slabinfo instead? > >> > > Hi, > > > The initial purpose was to obtain the type of each slab through > > a simple command 'cat proc/slabinfo'. So here, my intention is not to > > update all slabinfo-related tools for the time being, but to modify > > the version number of proc/slabinfo and further display the results > > of using the command. > > I'm not sure you understand the concern. There are existing consumers of > /proc/slabinfo, that might become broken by patch 1/2. We don't even know > them all, they might not be all opensource etc. So we can't even make sure > all of them are updated. What can happen after patch 1/2: > - they keep working and ignore the new column (good) > - they include a version check and notice a new unsupported version and > refuse to work > - confused by the new column they start throwing error, or report wrong > stats (that's worse) > I generally understand your concerns about modifying patch 1/2. But judging from my modifications, this worry does not seem to be valid. Because the “/proc/slabinfo” is not used in related slabinfo debugging tools (such as tools/mm/slabinfo), but "/sys/kernel/slab/<slab_name>/" (in Documentation/mm/slub.rst) or "/ sys/kernel/debug/slab" (in tools/mm/slabinfo.c). Furthermore, the current modification only involves optimizing the output of proc/slabinfo, and does not modify the struct slabinfo or struct kmem_cache. So there is no need to adapt other modifications. > >> How about we simply do nothing? > > Agreed wrt modifying /proc/slabinfo > > > The note here means what changes will occur after > > we modify the version number of proc/slabinfo to 2.2. > > As for the replacement of tools/mm/slabinfo (that inspired > > by Christoph’s suggestions), it will be implemented in the next version > > or even the later version. > > So what is your motivation for all this in the first place? You have some > monitoring tool that relies on /proc/slabinfo and want to distinguish > reclaimable caches? So you can change it to parse the /sys directories. Is > it more work? Yes, but you only have to do that once per boot, because > unlike the object/memory stats in /proc/slabinfo, the reclaimable flag will > not change for a cache. > The situation as you mentioned is very suitable for my current needs. My original intention is just to get an intuitive slab screen through a simple ‘cat proc/slabinfo’ command. As for the description "<slabreclaim> comes from the collected results in the file /sys/kernel/slab/$cache/reclaim_account" may not be appropriate. Here I want to express that the column <slabreclaim> has the same effect as traversing "/sys/kernel/slab/$ cache/reclaim_account". > Would tools/mm/slabinfo almost work for you, but you're missing something? > Then send patches for that in the first place. Changing /proc/slabinfo (and > breaking other consumers) for a quick and easy fix with a different solution > planned for the future is simply not feasible. > Using the slabinfo tool to parse /sys/kernel/slab/$cache/reclaim_account is what I think about optimizing future tools during the discussion. It will not affect the current patch 1/2, and patch 2/2 is mainly to supplement the output examples of proc/slabinfo. If the community is willing to accept it, I will only modify patch 1/2 to implement it. Thanks very much! > HTH, > Vlastimil > > > Thanks! >
On 2/20/24 09:49, zhang fangzheng wrote: > On Mon, Feb 19, 2024 at 4:09 PM Vlastimil Babka <vbabka@suse.cz> wrote: >> >> On 2/19/24 07:23, zhang fangzheng wrote: >> > On Mon, Feb 19, 2024 at 12:24 PM Matthew Wilcox <willy@infradead.org> wrote: >> >> >> >> On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: >> >> > +Note, <slabreclaim> comes from the collected results in the file >> >> > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo >> >> > +as deprecated and recommend the use of either sysfs directly or >> >> > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. >> >> >> >> Wait, so you're going to all of the trouble of changing the format of >> >> slabinfo (with the associated costs of updating every tool that currently >> >> parses it), only to recommend that we stop using it and start using >> >> tools/mm/slabinfo instead? >> >> >> >> Hi, >> >> > The initial purpose was to obtain the type of each slab through >> > a simple command 'cat proc/slabinfo'. So here, my intention is not to >> > update all slabinfo-related tools for the time being, but to modify >> > the version number of proc/slabinfo and further display the results >> > of using the command. >> >> I'm not sure you understand the concern. There are existing consumers of >> /proc/slabinfo, that might become broken by patch 1/2. We don't even know >> them all, they might not be all opensource etc. So we can't even make sure >> all of them are updated. What can happen after patch 1/2: >> - they keep working and ignore the new column (good) >> - they include a version check and notice a new unsupported version and >> refuse to work >> - confused by the new column they start throwing error, or report wrong >> stats (that's worse) >> > I generally understand your concerns about modifying patch 1/2. > > But judging from my modifications, this worry does not seem to be valid. > Because the “/proc/slabinfo” is not used in related slabinfo debugging tools > (such as tools/mm/slabinfo), Hi, we are not concerned about slabinfo debugging tools that are part of kernel source tree, but about those outside, including those created privately and we don't even know they exist. > but "/sys/kernel/slab/<slab_name>/" (in > Documentation/mm/slub.rst) or "/ sys/kernel/debug/slab" (in > tools/mm/slabinfo.c). > > Furthermore, the current modification only involves optimizing the output > of proc/slabinfo, It's not "only", the output of /proc/slabinfo is what those tools consume, so that's what concerns us the most. > and does not modify the struct slabinfo or struct kmem_cache. > So there is no need to adapt other modifications. These on the other hand are internal details of the kernel which we can modify as much we want >> >> How about we simply do nothing? >> >> Agreed wrt modifying /proc/slabinfo >> >> > The note here means what changes will occur after >> > we modify the version number of proc/slabinfo to 2.2. >> > As for the replacement of tools/mm/slabinfo (that inspired >> > by Christoph’s suggestions), it will be implemented in the next version >> > or even the later version. >> >> So what is your motivation for all this in the first place? You have some >> monitoring tool that relies on /proc/slabinfo and want to distinguish >> reclaimable caches? So you can change it to parse the /sys directories. Is >> it more work? Yes, but you only have to do that once per boot, because >> unlike the object/memory stats in /proc/slabinfo, the reclaimable flag will >> not change for a cache. >> > The situation as you mentioned is very suitable for my current needs. > My original intention is just to get an intuitive slab screen through a > simple ‘cat proc/slabinfo’ command. As for the description "<slabreclaim> That would be nice, but again we must be careful about existing consumers of /proc/slabinfo so we can't always have nice things. > comes from the collected results in the file > /sys/kernel/slab/$cache/reclaim_account" > may not be appropriate. Here I want to express that the column <slabreclaim> has > the same effect as traversing "/sys/kernel/slab/$ cache/reclaim_account". > >> Would tools/mm/slabinfo almost work for you, but you're missing something? >> Then send patches for that in the first place. Changing /proc/slabinfo (and >> breaking other consumers) for a quick and easy fix with a different solution >> planned for the future is simply not feasible. >> > Using the slabinfo tool to parse /sys/kernel/slab/$cache/reclaim_account > is what I think about optimizing future tools during the discussion. > It will not affect the current patch 1/2, and patch 2/2 is mainly to > supplement the output examples of proc/slabinfo. > > If the community is willing to accept it, I will only modify > patch 1/2 to implement it. > > Thanks very much! > >> HTH, >> Vlastimil >> >> > Thanks! >>
On Tue, Feb 20, 2024 at 5:21 PM Vlastimil Babka <vbabka@suse.cz> wrote: > > On 2/20/24 09:49, zhang fangzheng wrote: > > On Mon, Feb 19, 2024 at 4:09 PM Vlastimil Babka <vbabka@suse.cz> wrote: > >> > >> On 2/19/24 07:23, zhang fangzheng wrote: > >> > On Mon, Feb 19, 2024 at 12:24 PM Matthew Wilcox <willy@infradead.org> wrote: > >> >> > >> >> On Mon, Feb 19, 2024 at 11:19:11AM +0800, Fangzheng Zhang wrote: > >> >> > +Note, <slabreclaim> comes from the collected results in the file > >> >> > +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo > >> >> > +as deprecated and recommend the use of either sysfs directly or > >> >> > +use of the "slabinfo" tool that we have been providing in linux/tools/mm. > >> >> > >> >> Wait, so you're going to all of the trouble of changing the format of > >> >> slabinfo (with the associated costs of updating every tool that currently > >> >> parses it), only to recommend that we stop using it and start using > >> >> tools/mm/slabinfo instead? > >> >> > >> > >> Hi, > >> > >> > The initial purpose was to obtain the type of each slab through > >> > a simple command 'cat proc/slabinfo'. So here, my intention is not to > >> > update all slabinfo-related tools for the time being, but to modify > >> > the version number of proc/slabinfo and further display the results > >> > of using the command. > >> > >> I'm not sure you understand the concern. There are existing consumers of > >> /proc/slabinfo, that might become broken by patch 1/2. We don't even know > >> them all, they might not be all opensource etc. So we can't even make sure > >> all of them are updated. What can happen after patch 1/2: > >> - they keep working and ignore the new column (good) > >> - they include a version check and notice a new unsupported version and > >> refuse to work > >> - confused by the new column they start throwing error, or report wrong > >> stats (that's worse) > >> > > I generally understand your concerns about modifying patch 1/2. > > > > But judging from my modifications, this worry does not seem to be valid. > > Because the “/proc/slabinfo” is not used in related slabinfo debugging tools > > (such as tools/mm/slabinfo), > > Hi, > > we are not concerned about slabinfo debugging tools that are part of kernel > source tree, but about those outside, including those created privately and > we don't even know they exist. > For your concerns, I think the supplementary introduction that new output results of slabinfo v2.2 in patch 2/2 will be necessary. This can help them optimize their tools more quickly to adapt to proc/slabinfo. Is this more friendly? > > but "/sys/kernel/slab/<slab_name>/" (in > > Documentation/mm/slub.rst) or "/ sys/kernel/debug/slab" (in > > tools/mm/slabinfo.c). > > > > Furthermore, the current modification only involves optimizing the output > > of proc/slabinfo, > > It's not "only", the output of /proc/slabinfo is what those tools consume, > so that's what concerns us the most. > > > and does not modify the struct slabinfo or struct kmem_cache. > > So there is no need to adapt other modifications. > > These on the other hand are internal details of the kernel which we can > modify as much we want > > >> >> How about we simply do nothing? > >> > >> Agreed wrt modifying /proc/slabinfo > >> > >> > The note here means what changes will occur after > >> > we modify the version number of proc/slabinfo to 2.2. > >> > As for the replacement of tools/mm/slabinfo (that inspired > >> > by Christoph’s suggestions), it will be implemented in the next version > >> > or even the later version. > >> > >> So what is your motivation for all this in the first place? You have some > >> monitoring tool that relies on /proc/slabinfo and want to distinguish > >> reclaimable caches? So you can change it to parse the /sys directories Is > >> it more work? Yes, but you only have to do that once per boot, because > >> unlike the object/memory stats in /proc/slabinfo, the reclaimable flag will > >> not change for a cache. > >> > > The situation as you mentioned is very suitable for my current needs. > > My original intention is just to get an intuitive slab screen through a > > simple ‘cat proc/slabinfo’ command. As for the description "<slabreclaim> > > That would be nice, but again we must be careful about existing consumers of > /proc/slabinfo so we can't always have nice things. > > > comes from the collected results in the file > > /sys/kernel/slab/$cache/reclaim_account" > > may not be appropriate. Here I want to express that the column <slabreclaim> has > > the same effect as traversing "/sys/kernel/slab/$ cache/reclaim_account". > > > >> Would tools/mm/slabinfo almost work for you, but you're missing something? > >> Then send patches for that in the first place. Changing /proc/slabinfo (and > >> breaking other consumers) for a quick and easy fix with a different solution > >> planned for the future is simply not feasible. > >> > > Using the slabinfo tool to parse /sys/kernel/slab/$cache/reclaim_account > > is what I think about optimizing future tools during the discussion. > > It will not affect the current patch 1/2, and patch 2/2 is mainly to > > supplement the output examples of proc/slabinfo. > > > > If the community is willing to accept it, I will only modify > > patch 1/2 to implement it. > > > > Thanks very much! > > > >> HTH, > >> Vlastimil > >> > >> > Thanks! > >> >
diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 104c6d047d9b..89ab92f6be2d 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -892,6 +892,39 @@ Linux uses slab pools for memory management above page level in version 2.2. Commonly used objects have their own slab pool (such as network buffers, directory cache, and so on). +Example output. You can have all of these fields in slabinfo - version: 2.2. + +:: + + > cat /proc/slabinfo + + slabinfo - version: 2.2 + # name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail> <slabreclaim> + zspage 2240 2240 72 56 1 : tunables 0 0 0 : slabdata 40 40 0 0 + zs_handle 17408 17408 8 512 1 : tunables 0 0 0 : slabdata 34 34 0 0 + f2fs_xattr_entry-254:48 312 312 208 39 2 : tunables 0 0 0 : slabdata 8 8 0 1 + imsbr_flow 102 102 80 51 1 : tunables 0 0 0 : slabdata 2 2 0 0 + ...... + ext4_groupinfo_4k 312 312 208 39 2 : tunables 0 0 0 : slabdata 8 8 0 1 + dm_verity_fec_buffers 8 8 4048 8 8 : tunables 0 0 0 : slabdata 1 1 0 0 + dm_bufio_buffer 28 28 144 28 1 : tunables 0 0 0 : slabdata 1 1 0 1 + ...... + kernfs_iattrs_cache 4010 4116 96 42 1 : tunables 0 0 0 : slabdata 98 98 0 0 + kernfs_node_cache 67169 67232 128 32 1 : tunables 0 0 0 : slabdata 2101 2101 0 0 + mnt_cache 5624 5700 320 25 2 : tunables 0 0 0 : slabdata 228 228 0 0 + filp 15840 17400 320 25 2 : tunables 0 0 0 : slabdata 696 696 0 0 + ...... + kmalloc-32 30398 32384 32 128 1 : tunables 0 0 0 : slabdata 253 253 0 0 + kmalloc-16 31566 31744 16 256 1 : tunables 0 0 0 : slabdata 124 124 0 0 + kmalloc-8 51623 51712 8 512 1 : tunables 0 0 0 : slabdata 101 101 0 0 + kmem_cache_node 416 416 128 32 1 : tunables 0 0 0 : slabdata 13 13 0 0 + kmem_cache 416 416 256 32 2 : tunables 0 0 0 : slabdata 13 13 0 0 + +Note, <slabreclaim> comes from the collected results in the file +/sys/kernel/slab/$cache/reclaim_account. Next, we will mark /proc/slabinfo +as deprecated and recommend the use of either sysfs directly or +use of the "slabinfo" tool that we have been providing in linux/tools/mm. + :: > cat /proc/buddyinfo