Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1233474pxb; Fri, 18 Feb 2022 03:36:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi2lb30wGeRPA9DpkzxzTGQ95NlEl3VEMvOqDE03c0xSQBDSnckjO7+1ldXmioz40qz81x X-Received: by 2002:a17:90b:1e12:b0:1b9:d1e7:22ba with SMTP id pg18-20020a17090b1e1200b001b9d1e722bamr12122185pjb.128.1645184211056; Fri, 18 Feb 2022 03:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645184211; cv=none; d=google.com; s=arc-20160816; b=yc3m6hSBAacxzRnC85PLsysxsf8fnnMw6EinQnStGpXNVRkSFS1l2j+bNEgTnvA8Gs 9QZpjFxfuYw+xbFsPDyvDJ3TGhhWWHiTaq/6H7JVmJacexTVu8n7l3BLL26fIkErrir7 iNfDvDdgVjcDK9OQhm/Fh99/THnU0mXDUPfDR90metStrLQm1hBCCjUh3v94jy2xl0Bz 9OEaGJJVSruFLi3whT0LDlVNPT5Pnihj1Rw9czp7G/pWER8cdt8MI2zsg0dySsonjcFS 07+1/vjqM/X2vGadXulLuUlMucHCtbbVBWg71LZ1mkNvzeWnCLmG0wnkIx9xcTw/wVlo d4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=lrJjOSlZs0RFEV6UUp2RZBd0hgUhU+tYGx7GxTEGTYY=; b=crKLckm9sM4d6fr+RyOd22vvgK/ExW8QlpgogK6q8w73DoE0S2uBCxXwtFQXnFeqNs uT2Kyu5EwNlemtTHgHM3G3lugSCe0iHZWOercTRuP++NrgfUqPe9czXTIZlTNdgfu5xM UuEqJ8E1Xa1OG2RHIUt1oXku4CzhJqFpJ4MHDxEXO820Y4W7TG+8OyNlDZaenRzFm1sa zWas14k4GjR0qlZXW21F3OMQRJaL8ksbtbq8qkHzRFw6p/XE9KouSHGilZZDR1Ly2SPJ cLKUEE1Su7804/gpLY9ukIMLlOIShRkFxUB+hel7e9ZFmbdEgF0CsSmUyj/Nh4Yr8ZU4 b40Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12si11689356pgt.445.2022.02.18.03.36.36; Fri, 18 Feb 2022 03:36:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234211AbiBRK7e (ORCPT + 99 others); Fri, 18 Feb 2022 05:59:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbiBRK7c (ORCPT ); Fri, 18 Feb 2022 05:59:32 -0500 Received: from smtpproxy21.qq.com (smtpbg702.qq.com [203.205.195.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77C82148669 for ; Fri, 18 Feb 2022 02:59:15 -0800 (PST) X-QQ-mid: bizesmtp75t1645181950tezeyhil Received: from localhost.localdomain (unknown [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 18 Feb 2022 18:59:03 +0800 (CST) X-QQ-SSF: 01400000002000B0E000B00M0000000 X-QQ-FEAT: JRmPfD6HWhykTEiQFDHsYliCQGMuGr/p1wXKShUhdXWhhe3xUHuf/+kdHbKS4 fp0hpVZZdSjOEGOhbT63p3zTTegZ+OP93BGy/PPgZ0yWELIEkvkrUYUIidhz0RVFG7uwlN7 RJMS0UndbhACo5/9cPDiXztSPScuGImCE/duiZV7sWy0XdpFToH1P57mMeynGT2CcJdSroc Bhx86Dgn4SjqSgtLJlPvtl2pmEUkhZkvHWOHmD7PIozVcX7keee3pGlGxznlXsmdcDoEjO8 PhvHP2xlQL18e82Yy9ma6/RAIvr9lILW3f+93uyvvIc14q0B14X6RGdLjlh2zY9pfUTXfAr 9GzHYC/s2zZzMhh2lk8cB8k4NhMdOr04mlQGhHR X-QQ-GoodBg: 2 From: tangmeng To: mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, peterz@infradead.org, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, tangmeng Subject: [PATCH 1/5] kernel/lockdep: move lockdep sysctls to its own file Date: Fri, 18 Feb 2022 18:58:57 +0800 Message-Id: <20220218105857.12559-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 kernel/sysctl.c is a kitchen sink where everyone leaves their dirty dishes, this makes it very difficult to maintain. To help with this maintenance let's start by moving sysctls to places where they actually belong. The proc sysctl maintainers do not want to know what sysctl knobs you wish to add for your own piece of code, we just care about the core logic. All filesystem syctls now get reviewed by fs folks. This commit follows the commit of fs, move the prove_locking and lock_stat sysctls to its own file, kernel/lockdep.c. Signed-off-by: tangmeng --- include/linux/lockdep.h | 4 ---- kernel/locking/lockdep.c | 35 +++++++++++++++++++++++++++++++++-- kernel/sysctl.c | 21 --------------------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 467b94257105..37951c17908e 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -16,10 +16,6 @@ struct task_struct; -/* for sysctl */ -extern int prove_locking; -extern int lock_stat; - #ifdef CONFIG_LOCKDEP #include diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 4a882f83aeb9..d36c55c3101c 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -64,19 +64,50 @@ #include #ifdef CONFIG_PROVE_LOCKING -int prove_locking = 1; +static int prove_locking = 1; module_param(prove_locking, int, 0644); #else #define prove_locking 0 #endif #ifdef CONFIG_LOCK_STAT -int lock_stat = 1; +static int lock_stat = 1; module_param(lock_stat, int, 0644); #else #define lock_stat 0 #endif +#ifdef CONFIG_SYSCTL +static struct ctl_table kern_lockdep_table[] = { +#ifdef CONFIG_PROVE_LOCKING + { + .procname = "prove_locking", + .data = &prove_locking, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, +#endif /* CONFIG_PROVE_LOCKING */ +#ifdef CONFIG_LOCK_STAT + { + .procname = "lock_stat", + .data = &lock_stat, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, +#endif /* CONFIG_LOCK_STAT */ + { } +}; + +static __init int kernel_lockdep_sysctls_init(void) +{ + register_sysctl_init("kernel", kern_lockdep_table); + return 0; +} +late_initcall(kernel_lockdep_sysctls_init); +#endif /* CONFIG_SYSCTL */ + DEFINE_PER_CPU(unsigned int, lockdep_recursion); EXPORT_PER_CPU_SYMBOL_GPL(lockdep_recursion); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 3cd3478b815d..682b3b3f2924 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -88,9 +88,6 @@ #ifdef CONFIG_RT_MUTEXES #include #endif -#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT) -#include -#endif #if defined(CONFIG_SYSCTL) @@ -1684,24 +1681,6 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, -#endif -#ifdef CONFIG_PROVE_LOCKING - { - .procname = "prove_locking", - .data = &prove_locking, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, -#endif -#ifdef CONFIG_LOCK_STAT - { - .procname = "lock_stat", - .data = &lock_stat, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, #endif { .procname = "panic", -- 2.20.1