From patchwork Mon Feb 19 03:19:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangzheng Zhang X-Patchwork-Id: 13562139 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 3DC43C48BC4 for ; Mon, 19 Feb 2024 03:20:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 823008D0003; Sun, 18 Feb 2024 22:20:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D34E8D0001; Sun, 18 Feb 2024 22:20:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69B278D0003; Sun, 18 Feb 2024 22:20:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5B7A68D0001 for ; Sun, 18 Feb 2024 22:20:56 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EA1B340208 for ; Mon, 19 Feb 2024 03:20:55 +0000 (UTC) X-FDA: 81807101670.27.CDC905A Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf06.hostedemail.com (Postfix) with ESMTP id 43F18180012 for ; Mon, 19 Feb 2024 03:20:52 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of fangzheng.zhang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=fangzheng.zhang@unisoc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708312854; 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: in-reply-to:in-reply-to:references:references; bh=TAXN3PtXYOjoe+UPy2mZJg/CF9SrRoL5j3Fm4QxnG7k=; b=5LdFZdhTb7K7/6Lj/EbVS4u4llADB5Xmvng4BXK4NRJnd2AzXjSxh8pyM5MlaPhsvy/XPR W0diNC32CRmc4OmQGAfuXsfRe1nLp0rs6oi4ftBLI3HL7VJj3XXoA4bIHbZKVht2bbHYvx B44wOO2sJbtTzp1Ot85xjcOWzhhpUYU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708312854; a=rsa-sha256; cv=none; b=JuPzcMLnIFfnAxSYxJjHzmoleaqYTyFSYDdwYeXR8U9ENmVH3pmQbQDsgbaVt5Vyp8uIXV 7Y0nczrrJKFYPwFa8xlmcfu6xA6e1qdaEnxo6FJY6pcKMbwNNmsCy4cXpFXBbh+x8S2Tzp Rc7g4l7PFd6EYOxB8MfePfnFHb8ONSw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of fangzheng.zhang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=fangzheng.zhang@unisoc.com; dmarc=none Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 41J3K3ud006324; Mon, 19 Feb 2024 11:20:03 +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 4TdSSh0lVdz2KDdHY; Mon, 19 Feb 2024 11:19:32 +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:00 +0800 From: Fangzheng Zhang To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Greg KH CC: , , , Fangzheng Zhang , Fangzheng Zhang , Yuming Han , Chunyan Zhang Subject: [PATCH V2 1/2] mm/slab: Add slabreclaim flag to slabinfo Date: Mon, 19 Feb 2024 11:19:10 +0800 Message-ID: <20240219031911.10372-2-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> MIME-Version: 1.0 X-Originating-IP: [10.0.73.72] X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com 41J3K3ud006324 X-Rspamd-Queue-Id: 43F18180012 X-Rspam-User: X-Stat-Signature: a91nky1yrsxet84k1azth4r6bxe5eyqg X-Rspamd-Server: rspam03 X-HE-Tag: 1708312852-575607 X-HE-Meta: U2FsdGVkX1+xytnJA/GG/y/9WMkUpr0HCOD9T5wuw1M0PP08J2N0sUqJGQLBoWVxmoHZj46n7uxXMthB2HmHsOevJ+siNhQF8ccmey20SVnR9iOT0UPwi/jWi7pjm37PazzfwhsULobpeetJkDUawG9cQs5zdMUIrh1Dv/Up4jd+uAaFaOZnlBxCHZ/KxvUVBApd2TQYGsGEA3fkP+HeM//b/nouZ9qShrJqPuNtZa4kiW5DsQDZn6dO+/8vHM5dReLE8ZmnWl7Ry0TmEbKsIO+277Wux1pGBLYkEXGXrNXFT4+8P2wmZs41pZ2skyNRHr/8vNu39t6HflJNjXCEvmewQJ1ON8cNts/j1ZJxk+oKQpbSu0+Wg3aZP3Xorxm1JBaPnu/3ATQO87Gjx9w/AOiPz83PhLjBIJj5/0WfMeIgZ6lAL36HHEXJ99PsRC43jmIm4JDIH08VVD1xg7718JFw0OjU3uoQPh/fe1ynnSsnr94cZNDnzwicmdb8ta7d1TP9bWKTUMWJ+F7zIvVC1uUgpDnSxVqrrlGf+SDVRXT4oaEGcH4RmPfuJ8q/7XxFt1u37efnAVES9Dsat48beITbS9htHGjsjVYEc9gQFFTIDvTzQ9SgCMpuH9IWntArr/fJwd/kHQibE0vBMVIUlDH+jRLwsRellaHcxsdPteI20y3Tij4h4gxlYfyKwwzc2avbuoQX10/w5kv5ikwGcrnQ17oFSj5dFK6zRnufWyEEU6Ssh2K28jSmSEdU6j1xIdvfglMKClb8pg7xL/3apScdabSHctGJBGn423J2dlHG69ExQ4tgoqyqqDcmAWPASgbF8dPTXeHoCE9n0IpD8sFMSgaNDdDgrSpVN7jDrjPyO2JGi0YVUo+h5vc+GgR4UAgiWjdVs1E= 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: List-Subscribe: List-Unsubscribe: In order to enhance slab debugging, we add slabreclaim flag to slabinfo. Slab type is also an important analysis point in slabinfo for per slab, when various problems such as memory leaks or memory statistics occur. Signed-off-by: Fangzheng Zhang --- mm/slab_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 238293b1dbe1..fd865ca335ea 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1035,10 +1035,10 @@ static void print_slabinfo_header(struct seq_file *m) * Output format version, so at least we can change it * without _too_ many complaints. */ - seq_puts(m, "slabinfo - version: 2.1\n"); + seq_puts(m, "slabinfo - version: 2.2\n"); seq_puts(m, "# name "); seq_puts(m, " : tunables "); - seq_puts(m, " : slabdata "); + seq_puts(m, " : slabdata "); seq_putc(m, '\n'); } @@ -1071,8 +1071,9 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m) seq_printf(m, " : tunables %4u %4u %4u", sinfo.limit, sinfo.batchcount, sinfo.shared); - seq_printf(m, " : slabdata %6lu %6lu %6lu", - sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail); + seq_printf(m, " : slabdata %6lu %6lu %6lu %6u", + sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail, + !!(s->flags & SLAB_RECLAIM_ACCOUNT)); slabinfo_show_stats(m, s); seq_putc(m, '\n'); } From patchwork Mon Feb 19 03:19:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangzheng Zhang X-Patchwork-Id: 13562141 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 C7AE5C48BC4 for ; Mon, 19 Feb 2024 03:24:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 565D78D0003; Sun, 18 Feb 2024 22:24:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EE868D0001; Sun, 18 Feb 2024 22:24:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B6308D0003; Sun, 18 Feb 2024 22:24:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2840C8D0001 for ; Sun, 18 Feb 2024 22:24:35 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ED9E71A01C3 for ; Mon, 19 Feb 2024 03:24:34 +0000 (UTC) X-FDA: 81807110868.15.645EF68 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by imf17.hostedemail.com (Postfix) with ESMTP id 8E2394000B for ; Mon, 19 Feb 2024 03:24:31 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of fangzheng.zhang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=fangzheng.zhang@unisoc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708313072; 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: in-reply-to:in-reply-to:references:references; bh=9vyRfTNG4hqy1ChcWYAwxL2sBvFByiWsigWbOQ6K1BI=; b=M/40P88b2LYauKrczyEG6Y2DSzV2RqQadeMa9qxBEPEB8eOZs4uZmX542EDSBLZze2nSLl q9WF7qCS2lcIZ7cjurJ1sci7YLXL04Ni3+ABPe2yvN13h0BmemsGViMtGVd2rE2IBNrS86 D7KQDreODoR9M1wrkv297zFBdX4V5uY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708313072; a=rsa-sha256; cv=none; b=l28MzPPIl2ZcVfHAbmDqXvKVJ1TJExROqxOXLqzDZ3wcf5wdrGXsIwKlNBXaneDYHfDtqd RS9tV6m+TiXF8ClBUz6tXnwkuFvO8Ovqe6zAFA+rgtg4JR5Huy6ikogg/p+VU6PggBHvGk E1o4oZQHlRG8iEbkdn3CYMIvLDsif9o= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of fangzheng.zhang@unisoc.com designates 222.66.158.135 as permitted sender) smtp.mailfrom=fangzheng.zhang@unisoc.com; dmarc=none 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 To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Greg KH CC: , , , Fangzheng Zhang , Fangzheng Zhang , Yuming Han , Chunyan Zhang 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> MIME-Version: 1.0 X-Originating-IP: [10.0.73.72] X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX02.spreadtrum.com (10.0.64.8) X-MAIL: SHSQR01.spreadtrum.com 41J3KDic006816 X-Rspamd-Queue-Id: 8E2394000B X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: nqdbcjxzy5rx4rxppjfasks3gnsrgk7m X-HE-Tag: 1708313071-80790 X-HE-Meta: U2FsdGVkX18AcmEv0fWIASuQyvgFpRt3lndMxozpE/ilJuT0mLJI3Dg3nSFw6FIP5Jb7T39m7AMktf57QRNAGnIBzjDghZRQbILaSfAEzY/hOdwUQZ0ccz0BwNaR2hI6QswZUEPob6OAVZk9gFkcCjleUaSUkmjECQnCNxa6DdjkECv9oQAB8BqBZFrHH15U1YZSCMN5PbXLf5QnPAtNvUf4eq86eNkVkTmXvWwRFGrwFydtS6QvIA9gyp0cPDwpUwrwnvMXm7jbDrzM+iLXp/slSMpjknXvK6OqduVZfw2S0eqc7mWt0O29PVXOLblklzNCLCElR6/9cFxnTBpYuJVtHqhLsdON6HOWAZY0N/o4r6aHEoByRHSxAe8iA8kjVCobHrkT819MMkUz8mTyd1UIiHyQFA4ziBCkpxiB6dl4ggaB7W/LbPN6kwso/kCsKwp9kTuhkdNy8X+z8gkai7utG4vqMDHk+8mff8VxW/3eNBx2kd7jXg0Tgb7aXOYsYObc2+Gx/xmf40s/TzGCGMIaGTb/3+Bes4HaQ85e6H9vWvaEpgjBzLU8TAgNPNDpF6RK6aswxLySSoQp8cWRbDUUCHHXcNth7HW7dbFXcG96tuQh6P5EMEZv2apj8gSi4eAPF95q2/enN/TmcLwX7TYU9MqODW4Gvvty6dOFHdaAboqxvm1o+CiL0rqMXg8cwb61YQnNQTCwjNzGjO7u7xFuEQKEhvSCji2+j/hDdQ9OvZi8mhsmHs53DYQSl8EAruPZOOUcYqQS1gWcSprlcT8qVroGyA9J205RabFSRlXcxsGRX/EHPfKYbz5KFWSuDu3bHc7Fjg0TtHXD3NA3BRbrXItDhEXSFBQ1+7AXDu2IgIBO3hi/nXPO4QHVshtvD1rZpQRsssnmfEA9bQsiONVCZiUA/jaSY3AY7RZAH0gLPe27L9Z2jcZCUM+TdBV733caHPAZQJYU1amlg/g N60h/XEW hWu7Ov1a43EKWOetHC5wlEJ1YVO82w0mgRlw/eFKzapoFeMJBtT26DJv3uhhA5YpIQjBiA1rGqaHI2kHSs3UCvSH9do0B17gGI4mtDJUAoXVO0x4IvmqmH6sN6oEylUMTXxPraxOQI51r5LFHXgjwwcwifd0FBD4dVwLvPcRzQwuqwSqomz4oH4U+P2YeMe6259NGKHsaBEr+ECcBrUHR4u2K9ZMHO0wWPmR2/9u1PuQ2FTaEkZktMjmjUujOLM+MMrdEQpttI63xdZI= 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: List-Subscribe: List-Unsubscribe: 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 --- Documentation/filesystems/proc.rst | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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 : tunables : slabdata + 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, 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