From patchwork Tue Jun 4 06:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684723 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0509613DDAB; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=sxB6uXA6goj0qgCzhQ1dUb8auWjwgbfmzcG7zdpxAYb6fJ4naRSUz+fRyMd9E8rxeU5ol7b8D7+KUJQgxDLabfDiIGVsQy2tns8geEYFoYEfm+/AHgLpM004xQhrGzu4mAQEbRwcdrCYQzg42fQ7e+Omke9XCVIgq/ezen21/ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=vlte7/jFt4SHMLHwVPqBFv0PbVs5A4Gx+169UcJVYx4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B3NWpO0lKUHNRMMKwErf2lGzqBI2KFRiXkolMeVsnWDSsB01lbwd1hef1R0Snsa2m2mLGTmkLge3tmz9y6WG4ET4PFhLJkHQIRWPnK1Iqgh39KE08NV6jmfsOwv5lBsLT9cKon4WlvvVRL6Qc5ATSBiY1Df8aWRDViCptGsHhu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Janm6h/L; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Janm6h/L" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9D302C4AF07; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=vlte7/jFt4SHMLHwVPqBFv0PbVs5A4Gx+169UcJVYx4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Janm6h/LdugNk9//EITCAQZDYPDw1vSnkgIxHRJuajbB1uhJNb70fHHifyUdgIwcd Mg/HAMdxAw36cEdgsIlgBSdWy4Hc1od48ze7wM/QiaaAiTJzgstk8udBt6Zdg8/iOG f8VuGNUzWuQKpYFFGRqCGi2qBuVHvmp/E7SYChkdTKQTlffnCQs8/lsca4Kg0BegZL IM1CNUrig4EYtykD2DZQb1tjvma1ZoZXSYPE3wH1aCO3p6Z2ja0uG2BkYSqWU3Y4yB 6bsIl/ubhru7xQrDX8TdX9KSM4vlh1VmOObgZh71649aGA8FYEifSv59esu8EEoPN4 xSTPH1D/d4gTQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8419BC27C52; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:19 +0200 Subject: [PATCH 1/8] locking: Remove superfluous sentinel element from kern_lockdep_table Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-1-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=860; i=j.granados@samsung.com; h=from:subject:message-id; bh=14739GNIvIP1jcOFEalMBBReb5ieHSFF2clMwb/AQoM=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGJabxTBGOF4nHQDP1wm5ErY55X5yT1ko moGhHsQTVtxBIkBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRiAAoJELqXzVK3 lkFPreYMAIXr/sxZeeYa1hpzMSQR+LDo1okDOTVaAB6RI94p35Ph0NodstJFVE8/a/F7z8yznfT zRGB5mwTfERvnAHoLRa4cRPV7deYGX2Lfl4gRBxx38VVMXVNXGHuX412vQ/HGw8IG9A/McpDk0u Z2K9H7mdffgtNOrik+M5doL2wo8aIl3n/ntCbrFS6KMi5BjMA6JTGcCKPQc09MMFN8iWCyUlpHv PO0MOmlqI+ydfIGKM3grwe0ygIghPE7rXbC+RmQ/CFoPVTtuysPBixbT389HdPi2kwZfc3yMdiG JqIDpGDgEfx6eBoHqPi9f6UjsZsRZ8uQjA3cPhNf2r57I/Ous7iFkFzWnm9lsT7juRvP2yBLdve Fsb5u3LI21rJQdi9hKHm+Qy0a7lF7daS5ISDeA9YiPhRmI4qFElN50yOxuLkzeWdOmUek/m7eVe mIrjNatEmaWnNaLmtaw3exq+Eoi54Rdh5QCBMA0GRO+dVR2JtZ85j6nhTdGkijeKFOoJQ/Vz+O5 Xc= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados This commit is part of a greater effort to remove all empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) Signed-off-by: Joel Granados --- kernel/locking/lockdep.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 151bd3de5936..726b22ce7d0b 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -97,7 +97,6 @@ static struct ctl_table kern_lockdep_table[] = { .proc_handler = proc_dointvec, }, #endif /* CONFIG_LOCK_STAT */ - { } }; static __init int kernel_lockdep_sysctls_init(void) From patchwork Tue Jun 4 06:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684721 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D488265F; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482599; cv=none; b=lPFytXORno4S3q0xaHmelcP4OlTc65qJ1fN1HlX3bB4Uuw9iO24VPg2y0B5oH18QzAin6F3tkCD7Y+roiOy6equSI+DuROQ4Y29NfAD1Wmw3zh7CRxT1rJWOPIjmP4APSl3sJwYVGrjP8GiB7M423bIdRVvFGE8bru6dFJ9Pdoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482599; c=relaxed/simple; bh=WuskAK9QMw2Rb7LOBaE2ncAcIhSptttUqQRlOQ8Mdw8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lviFPPfMP73KQSzaD9/9jH1FbUn0uAmUjpEyPiwnCqL2Cit5Nle78CN3wD/NZ90pwyw1UW2gj1R5+gSshndZf0KUmis5QgXjJYKkkMPx7qWsz0750XFKdr7P0uSYDH61DqWwlD/6bu3tguFcxTly/q6ZI75UM+jTg88095XK7Wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XmOaJBCN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XmOaJBCN" Received: by smtp.kernel.org (Postfix) with ESMTPS id A60A5C4AF08; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=WuskAK9QMw2Rb7LOBaE2ncAcIhSptttUqQRlOQ8Mdw8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XmOaJBCNNhIk3UU18TsE4jmyx7Lq7jCrOLUmJNxjqPDcCFDgQl2DmJgWeBoO5O2cy hbtVw89hITlfEkLbn7HfQHjHjdjQZjHcowoB5tpg7avtohdheMiJ17HGEWrP0NXZei QltPuZBue7VdCJkD9utcSgbTjV0DFdShfUCtR075TP9XMLt5aJ7lP6hAPskiJeheoH 6c68TGQVytiKrJkdqreOoQGp0MOMHBx47+s6j+SBYvRz4QBvPWtVhDrSfGAGlSHBn9 jNtKztz+66GA9ocoVqZV/4PWQhpUzXoz3Y989QMQ/jChKBqmFU0IVRf2ioegPhQyHV /Tu0jucWCC6UA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 935DDC27C54; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:20 +0200 Subject: [PATCH 2/8] mm profiling: Remove superfluous sentinel element from ctl_table Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-2-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=862; i=j.granados@samsung.com; h=from:subject:message-id; bh=grXyma2z6K/wRopvypgEfIMP+PFHWBDb7VqNp82ood4=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGLtay8GHHZfoulwDT7Cp/+NFmjaUVFeN K1kk9wfksxNuIkBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRiAAoJELqXzVK3 lkFPLVQL/RZBp0EyIV+vm0gXQg6+z7wQ3w++rqI1ydJNjnUfIkWxiBXMoWjegWKgorptI5L0LL5 QiBGzg09KK78sYzgGlTjTudseX5pEj0wPgl5NA41VUKS3+eKByodee1SAT7w/5KgDAtjOwJiCmx hsXoF/SogQ0PJnNF+lZgwNnSukeE3eotjMuL0fhv7BGE9TwpcF7pOGrqB8AmLn91nFXyVOWjtBj Y/BhWU1/R5n57AbIDkaR04pcY907qAipnMbKVrminTdDhcjrYBuoX2O3K/WsV5UGPLWxg7Pwr2+ DKSCcd3f7cgKGvrqvuO0E1bsr+dsJj2zRAGJsSJtpfUhQ5A/KnmBUxbFb6W6IGbQVIfeAia9jys u3mALmKeyGRvnUkSMmH+z8yrhDmtI4Hn4lQUh9MofiwVN8fBR64dUuoxfVJhH2vHrg9PEnToAUN 6djR12wRe1b3eoxy8lGrrPi6EMi8z7R+qmxIqSo83Up6qfK7p2AMUDkiSJY6aoyusP77KXPACI5 0I= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados This commit is part of a greater effort to remove all empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) Removed sentinel from memory_allocation_profiling_sysctls Signed-off-by: Joel Granados --- lib/alloc_tag.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index 11ed973ac359..7293cd54d1b1 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -238,7 +238,6 @@ static struct ctl_table memory_allocation_profiling_sysctls[] = { #endif .proc_handler = proc_do_static_key, }, - { } }; static int __init alloc_tag_init(void) From patchwork Tue Jun 4 06:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684727 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3EBB513F00B; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=CranHYsDU7Sku8pVk/5hUb91u6a38bu6UymyQLIeMDtBoJmG4kmxmHxtvQGROzV6Vd0S7H4nrDbozMJKGfQC1J7Suj9ZZYse0UkLgCO/qA527ytsiFjp/8q2V+oNeyM1OrSygK1XmdkupKeDLVR2MBajr7jlOFIDdxEHrRdpq2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=SiVUhtxONKQWX+BBZwI127KwpXG2Q3vZOfxEJQppcWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aTPjr08EU30OsYxEJaA8/kBvA7qYA24drM+cYqyagj+qklaIHwd7ASDWYTFwcK+xQUSnzuRMx1rSjg8JeksyIh7ev3hEmBjTdhpbZHIewkcxHFjd4r1HfEIrquA0BR99bDmZRfnqbejGoaJwR/t3aZ1+9i4LZL9u2dHB5D9V8iY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pA4dmeog; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pA4dmeog" Received: by smtp.kernel.org (Postfix) with ESMTPS id AEBC7C4AF09; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=SiVUhtxONKQWX+BBZwI127KwpXG2Q3vZOfxEJQppcWk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=pA4dmeogTARSZfUZ/Gh9KHrzmf7wDP8GqwUGhu5YY1UfYSpIYx7Ne3usxtGqOwF2J mA5x5+xvD0pZwhihYG1Ufi1aaFA8o2vmdw121w6VUTnpX7cM1CcG8/w9hdles60tLI 5sNqVzC6xqZol58Rt0b4wJcCTQLTqh5WaMaM1gJt8R8rFyUCTLy2e78mU5MjXxt9xv 3+j9/MOmODLqmTStj6lUdjNt3QeZfewviDek6mipvnJGN1KTs8WIU/WH4EyjcrQx5i x+Sbm2GdzftBbBsodZq+OgHOAWOsgB5lDdMspCkESqr7WUTz24atJeZbtBMslDcz/A Xah1DKevIQW2w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F52C27C55; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:21 +0200 Subject: [PATCH 3/8] sysctl: Remove check for sentinel element in ctl_table arrays Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-3-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2348; i=j.granados@samsung.com; h=from:subject:message-id; bh=mD4Ze/7MDPElpYuv5XGK8tVRov3P49zLBw+A3YRwezE=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGMc5UA19wZYyokNq00ONpu/iFrRM3b3d ji21KMQyCufh4kBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRjAAoJELqXzVK3 lkFPjSkL/jbkTtKEHy2F4Zoay4bUyht8qYvmVrqYV35vhM08LmptpbTf9aDW49d1wvwom8i7zTo +bkTEJ+q5fEM8JibuQ4wBCwuyN55TQaiyynC6+P1sISJFiR+wNNKUkzoJZJuds9xIN3VHDBujmF hNT6GLin8xncVd6bXgjH1ukPvQamXDCmxcTzZ2ES5fPV4d063gEAAo0nfHkZRnPYcBfiPAf6E0W 6G/lTK5uCzNa1ienyagjyYa/UhAA/5IR33bkyguc9SGsBIZ5T33xBdFUHEfNS3GwclPA2Yt2jZ1 LYUI6YkfSftzj365NjA/UIsfGOdho/i4+CyV68VYXCQ0uQqSokz3ckRi9m/9JJOmT+qgzaSJbad kdWkSUcfn0vkojZPlpE8X3ed9U671GRAu0H/6f3Mv1yLfMoZEfspW68GFf+XV2mwWYYfmJl8rny mq0grO/Kf0H96o3+fcySffKJnyun8yE/Sil4YyRoh2AS4mwi23lOtffZxZJuyJcUTavw5iP4Pw6 PI= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados Use ARRAY_SIZE exclusively by removing the check to ->procname in the stopping criteria of the loops traversing ctl_table arrays. This commit finalizes the removal of the sentinel elements at the end of ctl_table arrays which reduces the build time size and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) Remove the entry->procname evaluation from the for loop stopping criteria in sysctl and sysctl_net. Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 2 +- net/sysctl_net.c | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index b1c2c0b82116..d4ba7ad9dbe0 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -21,7 +21,7 @@ #define list_for_each_table_entry(entry, header) \ entry = header->ctl_table; \ - for (size_t i = 0 ; i < header->ctl_table_size && entry->procname; ++i, entry++) + for (size_t i = 0 ; i < header->ctl_table_size; ++i, entry++) static const struct dentry_operations proc_sys_dentry_operations; static const struct file_operations proc_sys_file_operations; diff --git a/net/sysctl_net.c b/net/sysctl_net.c index f5017012a049..19e8048241ba 100644 --- a/net/sysctl_net.c +++ b/net/sysctl_net.c @@ -127,7 +127,7 @@ static void ensure_safe_net_sysctl(struct net *net, const char *path, pr_debug("Registering net sysctl (net %p): %s\n", net, path); ent = table; - for (size_t i = 0; i < table_size && ent->procname; ent++, i++) { + for (size_t i = 0; i < table_size; ent++, i++) { unsigned long addr; const char *where; @@ -165,17 +165,10 @@ struct ctl_table_header *register_net_sysctl_sz(struct net *net, struct ctl_table *table, size_t table_size) { - int count; - struct ctl_table *entry; - if (!net_eq(net, &init_net)) ensure_safe_net_sysctl(net, path, table, table_size); - entry = table; - for (count = 0 ; count < table_size && entry->procname; entry++, count++) - ; - - return __register_sysctl_table(&net->sysctls, path, table, count); + return __register_sysctl_table(&net->sysctls, path, table, table_size); } EXPORT_SYMBOL_GPL(register_net_sysctl_sz); From patchwork Tue Jun 4 06:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684722 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ED88E13DDA6; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=rxVUJgSWpHcQCsXa2+cfxVuO23EEl7Dsjd3LoZTi1AH2JhEuelHUZuJwX6gXZjepv6XaITkBpTkZ/3BBUDffrfasPlHl1WefB+RnjWI67iIFoY5YeZ5SQs6h7Zx6z7CWGCAd+Whg3BVpbo5ZjV4zjbyQSEoCfCM++HNxE7lpfrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=qnk8lkgaR1ZcTBtK8DdwuXgNlEzaf3fm9+u2f6xPjbg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CuZ4PxUdNaLb5PQXtzvZuZpVuRFB7WqcWc3zRyWtgKl323qAhmkm49jglDqyT2aFsw3EdNggi5qCOSZw47543GZhFaYs8QNs3w1WVkVVEVRm6B09KhKnsJmXMHmWzy5/UcCiuAA5YC6p88lDF8qPp1bRPYgDrkYHxocrXzZUmjw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q8sqn2UI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q8sqn2UI" Received: by smtp.kernel.org (Postfix) with ESMTPS id BD22CC4AF0D; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=qnk8lkgaR1ZcTBtK8DdwuXgNlEzaf3fm9+u2f6xPjbg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=q8sqn2UING2yH+C0lcGQSy4ae0FcbWJrC/vs7mpC04KFg1OQJRvbK9zk+t5Fw/rIR EXSXQVp55YTwcmYQApUkmuu2iBDhC8iLZ0bQAqn5D1BkK/WZr+UBT8CZVt6H8PxIjg ZYTMUuFRe2XlLeU+UTju9SRDmbbt8ASi+Flu/QfnUo+d9b/v1GYlHruDAVJbdprcat 3tCLPSjEQ5pBzKJkGdHOWkbi9N6PHM1x1F5tWDqDHF9zPuM7Dadi3X/TJlDHqc4csl t5+ByLcktT3kpOOhg2GCTRNVMD3F3FnIkWuDh54RMgQoxxdZf52k9L2Y2XUmYe+gc1 BdW6AX8HkNm8Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAEEC25B7E; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:22 +0200 Subject: [PATCH 4/8] sysctl: Replace nr_entries with ctl_table_size in new_links Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-4-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2054; i=j.granados@samsung.com; h=from:subject:message-id; bh=qaxk3rDogN+ZQLc9uwmgCuRk4aqbCXJb1N+PNG5WkHU=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGPmD7WlkmXC06LM/3KIlA0dRX7bMC7EC Mz6CbqNQM1cIokBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRjAAoJELqXzVK3 lkFPAi8L/jtTQsXQjrugX/vUO+3ZfV6tbEgbfiD5VOWt6iknGkxcPfsh4zkeVU+8DtrCDQ0oTo0 GK2pL+u7ZNsuK18g4OX5tQMQVfAa2WTYIAakatrnYIpkAvyS/IRkkCpJAggBFnIPbUoauOXuhtL vVb5HV0xe3NZMqFfuzg3sgsCCwtnTZ9jKMfXD/KSW2MGFqGP+hgjtkXwyzoAvgnsgQOqsKCG6+x MvS/OHonmHCHQPsZIeZVrK1DRP4wZyzDTW2YybRazjY24n+c+5JZ5PPbI8ll/f29f2zjq7k3bRO ckeQIGnXL4rCPhIB82vSKkxAmUeD/pUQvw120K7thSuG4GGl0vhrTYxH5QkC783QZN3lH+lGPMO StmLrdQkPtEG7L0BcxN1FSMQGG2dXI3KUR2Noy5QDAu4bAwnQge1FBEVa/4NNgBhFN4NHyejdNR yFpQcnPYKczW4mfyKjeQDHvC7T9RuoIqhNR2eW/3Zmhz/KXrysvomOq3G2E40T12Zu/PH9FuYL5 l4= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados The number of ctl_table entries (nr_entries) calculation was previously based on the ctl_table_size and the sentinel element. Since the sentinels have been removed, we remove the calculation and just use the ctl_table_size from the ctl_table_header. Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index d4ba7ad9dbe0..1babb54347a4 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -1154,18 +1154,16 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ struct ctl_table_header *links; struct ctl_node *node; char *link_name; - int nr_entries, name_bytes; + int name_bytes; name_bytes = 0; - nr_entries = 0; list_for_each_table_entry(entry, head) { - nr_entries++; name_bytes += strlen(entry->procname) + 1; } links = kzalloc(sizeof(struct ctl_table_header) + - sizeof(struct ctl_node)*nr_entries + - sizeof(struct ctl_table)*(nr_entries + 1) + + sizeof(struct ctl_node)*head->ctl_table_size + + sizeof(struct ctl_table)*(head->ctl_table_size + 1) + name_bytes, GFP_KERNEL); @@ -1173,8 +1171,8 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ return NULL; node = (struct ctl_node *)(links + 1); - link_table = (struct ctl_table *)(node + nr_entries); - link_name = (char *)&link_table[nr_entries + 1]; + link_table = (struct ctl_table *)(node + head->ctl_table_size); + link_name = (char *)&link_table[head->ctl_table_size + 1]; link = link_table; list_for_each_table_entry(entry, head) { @@ -1188,7 +1186,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ } init_header(links, dir->header.root, dir->header.set, node, link_table, head->ctl_table_size); - links->nreg = nr_entries; + links->nreg = head->ctl_table_size; return links; } From patchwork Tue Jun 4 06:29:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684726 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 30EEB13E888; Tue, 4 Jun 2024 06:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=d4Exzy+3gm2oe6n4sxie1aERh2Q+64DREsVn55GCcb2hkcRCg7kG+WIPaPWnebjxbwDma+k44HiXpIg/Bf3nvGuPloOeA+b2GwlYIL3xXU2ts6ojVa1r3W8Ua4KnXJ6d++Kff2ZvNWO8AuF5H6lT6NjO+b1b62pDLOu6J7r8dOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=+9m/xQlKsI8pqumJbCIgfUOr4dYZwdwxkZ7BbsD0p9w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b3b05F5fiUZ9QKJhMpUR4f3pntiSFktJHpRDrMAg3pVdjOdSWxssua3r6+gWjWgM3uPJ1j0khSGprzmqn5u3zIk5GlXBeIkyBkqQ0zg2Peje867brjLvcFizfBZrGQzL5yIS2Dc44ZuOJwmeKueYkicbpTESF7GOlMBXSi+7VvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cypzoF8H; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cypzoF8H" Received: by smtp.kernel.org (Postfix) with ESMTPS id C6F46C4AF0E; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=+9m/xQlKsI8pqumJbCIgfUOr4dYZwdwxkZ7BbsD0p9w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cypzoF8HBNiKPC2nUW6/CDayI/9sb7tk1EtuIsF5LNkC/Vvb+lntmVYJEU2yPN3dA Ywxo0gc6flAZv29VpNp3LTsFajnFwGDogaqn6kUhNBrkFgUN3kNw2mvICiomWHaW1o N+5Gyr8ievMcOl/NAHnguvAJGOeRS/NOsViAWyNA+2fmH116RFJjF2A3licAft8U4L WcJb4OJewURJ4scZFVIoFS4fPM5kEwyLzJJLmbsLKAa3s1isHrTUfrwnxbG43DDnxT rsIt5LYSNnfJ5gvdtg0Bz7jZDaJltPCZITDdFXU3HuLeQl12etRnAYp0XrWrxis/B0 kvFEyjLzYCWdg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD3D1C27C53; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:23 +0200 Subject: [PATCH 5/8] sysctl: Remove superfluous empty allocations from sysctl internals Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-5-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1905; i=j.granados@samsung.com; h=from:subject:message-id; bh=dykX5g3MqGx15MATEKwwLa2ClmbIRatln9uC2eazckc=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGR3E2qjUjAS4q9w+HjZ+miKQrmluWXXn C0vkfATqOvX1okBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRkAAoJELqXzVK3 lkFPwCwL/jqnIEcEWutsOWB1UQTKFkNA7cz4uGlz1RuXDsLJxTehHd+yxHkXH/uC4QSeWlaJMhI y/M6hBaSMqyknpSMeXjgwML0myqcwanvUI52qQez7GuzEmaMStbuewJp4fIOopCHSV3fAefx++0 OYitv3k2B/txIQBpMqoHWgB9DejZcZzzB/KygVZrRs/vDrkWdIl5uMR3J/Ehw3MmcW+b2pU2os2 pXUQCyBxpa+rOAvWTm7MXOBOHZJnXlIKajR4RLbfGSvkNXJfLmHwY4XuCv2N9BXGX0RgCoMEYSM C5UiFki4U0ojWqyKLxg5Lj8T0XgxNjRvgtXo/ao/vdejeY7STem/sCXWVka8SWuXRY2YAFfBlcr mU7T+yqjI8JVf6MTCkQYPk9ueo5YHbqWt+oGCXPDUfFfELnkSsWHAsH0S782t4zi4XrmyP3bUZ9 KAkFDTj8PBaGvHxjxnIsU0ZxjNwxosVnynxuCAKNSU4szTgMzcl76Ck2/It8V8v3qnnHktCQJU7 uE= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados Now that the sentinels have been removed from ctl_table arrays, there is no need to artificially append empty ctl_table elements at ctl_table registration. Remove superfluous empty allocation from new_dir and new_links. Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 1babb54347a4..29d40f0ff3ff 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -951,14 +951,14 @@ static struct ctl_dir *new_dir(struct ctl_table_set *set, char *new_name; new = kzalloc(sizeof(*new) + sizeof(struct ctl_node) + - sizeof(struct ctl_table)*2 + namelen + 1, + sizeof(struct ctl_table) + namelen + 1, GFP_KERNEL); if (!new) return NULL; node = (struct ctl_node *)(new + 1); table = (struct ctl_table *)(node + 1); - new_name = (char *)(table + 2); + new_name = (char *)(table + 1); memcpy(new_name, name, namelen); table[0].procname = new_name; table[0].mode = S_IFDIR|S_IRUGO|S_IXUGO; @@ -1163,7 +1163,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ links = kzalloc(sizeof(struct ctl_table_header) + sizeof(struct ctl_node)*head->ctl_table_size + - sizeof(struct ctl_table)*(head->ctl_table_size + 1) + + sizeof(struct ctl_table)*head->ctl_table_size + name_bytes, GFP_KERNEL); @@ -1172,7 +1172,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_ node = (struct ctl_node *)(links + 1); link_table = (struct ctl_table *)(node + head->ctl_table_size); - link_name = (char *)&link_table[head->ctl_table_size + 1]; + link_name = (char *)(link_table + head->ctl_table_size); link = link_table; list_for_each_table_entry(entry, head) { From patchwork Tue Jun 4 06:29:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684725 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2F2BA13E884; Tue, 4 Jun 2024 06:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=VenVkDzfTjMV8ujWwfp136XMsMMaTGXrgAtNHvdA1Wr4P45AQVVuiYvw2uEg6YSZ9Kapha6HVEeBAlmR/4ZJY5DgiTOf3SrnGKd3kBEGVzr6mPBqA4m6OIedsbxaqFMxDEBccVc93YdRNS5lBKhta7R8rsH0evfBrD2Cq4T1x4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=uQvKTedfeUJ5bmniBUr9CwYhnYEum8lzyXgoPJAiEIM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NVS2b8/h7yH71IZL0AGqit5NITdNtvRvqZKu+ZWodneanEsFbmL6voDg74ZqlNFuvETdl92j0KeClhMXqlgxuwyYNkxT+DOGMTikoAF2pp0VRrj+uZCq+6h+c7qkuP2o7+zAqyecbEg7thSBbPUfADRu1iZazatZihZVBQuLjXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RkdsXLX/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RkdsXLX/" Received: by smtp.kernel.org (Postfix) with ESMTPS id D51BCC4AF12; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482599; bh=uQvKTedfeUJ5bmniBUr9CwYhnYEum8lzyXgoPJAiEIM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=RkdsXLX/rWNsSnP1w0vpeQO8ySbd33WZFy1o2u5e5N1MaiUcQP2TG2eJUTndxXt3q 6OxqXH4y8t+bk4SdJBB3SvyQOefglzILYK2uP527CPP9zD1yZnWraBkOBsm4sLCqvX /iqL5IFdy0HEEVY+3Hvot+cQfBKhwaGAZLW2Nbh42ex6j3bVFoM2Kgz7lYTG5Ge4cI NkKMcVXcV1cGMITbeti1Mx3rTuvfM1gBbZ8rdw4zC9O1kXyytocY5qr22xKPNCjSgi OLoI75IpKFkEerVQqpHzGSKIPc+6ljn5j5vYU/Lr5hciFXi8M3TBJ8M6gjr5QnTVYt UYTwzOiJ9VLAA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC4ADC27C52; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:24 +0200 Subject: [PATCH 6/8] sysctl: Remove "child" sysctl code comments Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-6-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2907; i=j.granados@samsung.com; h=from:subject:message-id; bh=0XKCBtKXUsaQ3icltpQ/GcT4z/xTnWSxXkUvgvEAqjc=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGSx+J2DsW2akHI1bXUBxwZLWJOp+r/vp Mjc/iI3BpjvEIkBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRkAAoJELqXzVK3 lkFP5qIL/1mam3EXhTaxS41hy26Dmq0UjeoUbnRZYhSzHmbvW3UT9tGd0CEzkRmrmeO5pdUckpq /Xdt4dyVI2zsF1mpS0/senLUoeACPSh46rmxp5ymGQQZ999WnsOewsF44Mjh/agSxFKYLIMWhTu HP0QK15UKiFYjQVS/IcARz0Rq96i8bWVETbMGfCvTSh9swmqxWj7VqNDY1mXl1MIHr+Mzh6tdB1 AHaTV/HasD29w/8TIBI7J+II662XOod/LWhfuSYUKtkxKQgMCOw8wqIouOv1s9sdsnFR/6uaxEC GOHVm1t4sQ7GsSyaRwvEVP/aB5SnRGWn6408TrOz7E/Jn2sabbqUB9Ordb2H8FP0Ss88mW8kE2O GNFLoqO6pDYyWYSvXKLsugRX5f17Zhth9sYOdKExC+60DIQg2SFQoQRXHGGSVPBDFu/eLBCxlx9 jOHJAUn2H18r9Amtf/jCtQG51NN+gJH/ndYTe9NkwKnQpjhiITpmpMdb6QjPMrDMs8MnrpY0xV6 tI= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados Erase the code comments mentioning "child" that were forgotten when the child element was removed in commit 2f2665c13af48 ("sysctl: replace child with an enumeration"). Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 29d40f0ff3ff..2ef23d2c3496 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -1298,28 +1298,23 @@ static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path) * __register_sysctl_table - register a leaf sysctl table * @set: Sysctl tree to register on * @path: The path to the directory the sysctl table is in. - * @table: the top-level table structure without any child. This table - * should not be free'd after registration. So it should not be - * used on stack. It can either be a global or dynamically allocated - * by the caller and free'd later after sysctl unregistration. + * + * @table: the top-level table structure. This table should not be free'd + * after registration. So it should not be used on stack. It can either + * be a global or dynamically allocated by the caller and free'd later + * after sysctl unregistration. * @table_size : The number of elements in table * * Register a sysctl table hierarchy. @table should be a filled in ctl_table * array. A completely 0 filled entry terminates the table. * * The members of the &struct ctl_table structure are used as follows: - * * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not * enter a sysctl file - * - * data - a pointer to data for use by proc_handler - * - * maxlen - the maximum size in bytes of the data - * - * mode - the file permissions for the /proc/sys file - * - * child - must be %NULL. - * + * data - a pointer to data for use by proc_handler + * maxlen - the maximum size in bytes of the data + * mode - the file permissions for the /proc/sys file + * type - Defines the target type (described in struct definition) * proc_handler - the text handler routine (described below) * * extra1, extra2 - extra pointers usable by the proc handler routines @@ -1327,8 +1322,7 @@ static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path) * [0] https://lkml.kernel.org/87zgpte9o4.fsf@email.froward.int.ebiederm.org * * Leaf nodes in the sysctl tree will be represented by a single file - * under /proc; non-leaf nodes (where child is not NULL) are not allowed, - * sysctl_check_table() verifies this. + * under /proc; non-leaf nodes are not allowed. * * There must be a proc_handler routine for any terminal nodes. * Several default handlers are available to cover common cases - From patchwork Tue Jun 4 06:29:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684728 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6684013FD9D; Tue, 4 Jun 2024 06:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=AO4ofHV1gLUb+Z19I9rzQQexA6Rqm2i0Y5KnYbxRx7mrMfvuJvBkgXrM/UTyZqNQRWPWZ4D7d9GRLoCdOuIl/tPmDwWhs1AqV1XgI750yFd0l89MeVBM2+/QSTTR8SvmgsL+9IeFg85qDMEkpJyywxmGzJ0ppryuJlOPqidzuC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=C/wJBaI+Nf//FLZ9qNdBqF9DbNgygnVG1KR7x04B2gE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M4iCpkQhVkZQ0UQP9X8rWsofVa1Gn37rVU/Bnu17PoHHe3vCtrkU5D6nMYapzkpQ0eAlZkv6NeMTS5diezFYX9PdwC/nmXPsfyfzbDkyfnzbit3Scn3G/OOc8ISi43VckRMyEOkFeJXktntr14CT0MkqlXWF8Qlh4ccQJPIDTNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YuRhARNo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YuRhARNo" Received: by smtp.kernel.org (Postfix) with ESMTPS id E1B5EC4AF1C; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482600; bh=C/wJBaI+Nf//FLZ9qNdBqF9DbNgygnVG1KR7x04B2gE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YuRhARNoR25hcvBkcNAUTgIhqRJKKbjGFRg5liFLM0brTj9UeK2wwzFmJKrQxqamc YhMzrvdgZoCRZbKxCTWmdcZt2armObHFKIjVKcN1WF6i9MiP2m/MI7MpPSdr3xq4nA buulh7QU9cov1UYJgez+xfYAOHl9uM1tSLfzv+zZlxQY9KTT98QMdcX/neht+YmmeU H9B/eFwudfX3UzBWsvd+61dvQtpkEI3yt+h0Vjfk0gqmTsFoBqx86m44y1LZOhoNYC udGaz9SUc07Z1u4LvBlpX5M7ELIQxpco4xgdtKDzFgP3nkuvOc63yqwPmbmR2cff7t JJ6h+s+XI3Xkw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8318C27C54; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:25 +0200 Subject: [PATCH 7/8] sysctl: Remove ctl_table sentinel code comments Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-7-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=882; i=j.granados@samsung.com; h=from:subject:message-id; bh=zTe/Mj/k43FhBaGgdPaFYoMPRIHkDQfZ6H7/ug1O6Cc=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGUkSr3CVpnP54k/+9PHKhfTTA69nKuVw AbWrpNS33D41YkBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRlAAoJELqXzVK3 lkFPCvYMAIUVsRJA74OqhAoo95LSMr9pMo00Icg5tPkk1tZPCHQkgj4cL2Zu2V5jRGwRSkLxp5H IR0HctTp2+yGtKeGn8qj4XbwZ1GKTdx2q8M7n61gfVtpwl28bbKBSCCdOBFet1Z/RjdfO7qztoE iqAoUGKhJ4gsokBwKCrCTFgKTFDOD+B/B0cVwfcFRYVxtxTf5kmtg7MlAOY+Jtu/e8SLt85+h+G qgaRnRK7WRFMhZpfhgYzt02oNXWGlM/cmg/oo5Jbw/oEvgvrEngxgzuwmKQpfugA0KyBDBLyV0J xRQlthY/U1hjOXj80QnD1wSXjQe85phvjRlxf36FOsL+TjkQvUf0Qgk1WDbuYwHsJpxk3avhU7n iF/b0D1fc+BUB06Ux0PTitZBh39pLgo+UsK2yLw215oBiL9sRILV+rwI03Mr3BOyAsxWImkNmUY jVhQLyQ2SE7sBmT6Q6jBK9ea/2wQ2/WOFtIjQk0eGHHJy4Yvc8q3GoGbYPe3jxNFcKzMnX+Iuw6 GA= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados Remove the mention of a "zero terminated entry" from the __register_sysctl_table function doc. Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 2ef23d2c3496..806700b70dea 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -1306,7 +1306,7 @@ static struct ctl_dir *sysctl_mkdir_p(struct ctl_dir *dir, const char *path) * @table_size : The number of elements in table * * Register a sysctl table hierarchy. @table should be a filled in ctl_table - * array. A completely 0 filled entry terminates the table. + * array. * * The members of the &struct ctl_table structure are used as follows: * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not From patchwork Tue Jun 4 06:29:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados via B4 Relay X-Patchwork-Id: 13684729 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 668F4140367; Tue, 4 Jun 2024 06:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; cv=none; b=C0g3d5XJOhFlHfroMcZRuvu5ZmLOR0a2xh25a7+mZXpaPQrM1lc5U7rxLlyZ1PJKVFz6MXmz0Iqod+qo9fNdl/8oeGaZX53nOVj1dRgviqrO4//eXRN5LFjisvMvFK8/ITJk+Ftq1ZoOWg6z/MJPwJqxbDJt1KOtq9GjDcNpjcQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717482600; c=relaxed/simple; bh=JGQT+4p7AHY1M4o7zhyH0qaV8X0DJMDz7KyqjSiOFsU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fD9jSjEg5bX437HfmoE+gkwaCBDGyAFpjotEoQbtSs5RsDwV/nPZ4BLbEpimw81OEGTFKbqvymtB7O5pK8S9BukYX1+wUPDEO4mdeuDfgyGlY8woXhxq0w8sP3GUZZ7bVc98DXs/4F00urXAEhnu4FvImNSyR66oeusk8QGbpew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ov31VYfk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ov31VYfk" Received: by smtp.kernel.org (Postfix) with ESMTPS id EDCD8C4AF4D; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717482600; bh=JGQT+4p7AHY1M4o7zhyH0qaV8X0DJMDz7KyqjSiOFsU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ov31VYfkZBszW6nagLY0k+JHZFiMxqJo3NcOel+En0isAe6LtNJ5y9FCZfVkctPXW 7LZXgH+PAQIjLBC9dyOCddavt9rrNFFKGGv6IMMcx3bY8Q7DqGre74pUdfLFZfUeNM hWdD2xN6klufntacPQjGZGfzu330vz/iZu8Nc3CaU4JkedUXKFzApi9J+FforQvK3M YIsRBX7BW2vwUnsRrgTn1x7qKJ1Af+hCmT3ykgBjrSZvvSwXqLZCZpZmizxPBxJYGG KGkvDazh0oyOkjL0uXlmsNAYBbMUKCvHSgZAiHOeVFQsshxaeKy8d+QttD2HlqsDLO QJJeoHRH5qHfA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4B6CC25B7E; Tue, 4 Jun 2024 06:29:59 +0000 (UTC) From: Joel Granados via B4 Relay Date: Tue, 04 Jun 2024 08:29:26 +0200 Subject: [PATCH 8/8] sysctl: Warn on an empty procname element Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240604-jag-sysctl_remset-v1-8-2df7ecdba0bd@samsung.com> References: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> In-Reply-To: <20240604-jag-sysctl_remset-v1-0-2df7ecdba0bd@samsung.com> To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Suren Baghdasaryan , Kent Overstreet , Andrew Morton , Luis Chamberlain , Kees Cook , Joel Granados , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=837; i=j.granados@samsung.com; h=from:subject:message-id; bh=kiBCYRLAjKste0XuHE2np63NWadPBoIGUUndp1NrN98=; b=owJ4nAHtARL+kA0DAAoBupfNUreWQU8ByyZiAGZetGXOjyV9+/Ko/a1TAa0g3yQtd6zwj6D29 kW6R7OTXh/JPokBswQAAQoAHRYhBK5HCVcl5jElzssnkLqXzVK3lkFPBQJmXrRlAAoJELqXzVK3 lkFPABkL/0chps6Tybj/Jceo6dk5TxaNFxxf/9U5ng/iiwgx4Aud25nQYC/AmsWbL/his/ClEv4 8BuIUh8G4fFijVL56/El1GEAVxd9J8z8s6c3d83lZ+7po/aWsz9lvgO6nh3tTe8U6TKKV+Rh0jL EKXjAJ+S4/CNLT4NBhCuIY4P4LyQIjgAxHx3p/ryNWc08tJJAK0bG+L3cllECbQ7X+usHu9Q9dq mg5tVGmxkunsrP/nLQNrlC+xpppGWp+fc5g9y/QeTAXHVHQMCZkeV5pJfgBWVGMUv9F7juRGJAB B5ySh3sHHaIo8scZIIYsRqWs1/4dR8vxgpa8iXykL41Px3oJuinO01eFG2gdAht/skleaLIIW5y k36ZfB4mYUmXBtSq/YEGDd4IerIixbbq7Hc5F+g+l7Eby59/gbzU06uOy3mGyuXFVzB0WHcZFiz +zN9loEzcIEe/WaIq9hQLiHtkj3fwCmwXLuAOl6RzQgKnNf/jXmyJJL30Dsd9/INhxAp1Tc7SA6 74= X-Developer-Key: i=j.granados@samsung.com; a=openpgp; fpr=F1F8E46D30F0F6C4A45FF4465895FAAC338C6E77 X-Endpoint-Received: by B4 Relay for j.granados@samsung.com/default with auth_id=70 X-Original-From: Joel Granados Reply-To: j.granados@samsung.com From: Joel Granados Add a pr_err warning in case a ctl_table is registered with a sentinel element containing a NULL procname. Signed-off-by: Joel Granados --- fs/proc/proc_sysctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 806700b70dea..f65098de5fcb 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -1119,6 +1119,8 @@ static int sysctl_check_table(const char *path, struct ctl_table_header *header) struct ctl_table *entry; int err = 0; list_for_each_table_entry(entry, header) { + if (!entry->procname) + err |= sysctl_err(path, entry, "procname is null"); if ((entry->proc_handler == proc_dostring) || (entry->proc_handler == proc_dobool) || (entry->proc_handler == proc_dointvec) ||