From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 11:36:40 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0219B5 for ; Wed, 18 Jun 2014 11:36:40 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F18526B8 for ; Wed, 18 Jun 2014 11:36:40 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 74E931FE026 for ; Wed, 18 Jun 2014 13:36:32 +0200 (CEST) Message-ID: <53A179D5.8020604@selasky.org> Date: Wed, 18 Jun 2014 13:36:53 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: FreeBSD Current Subject: [RFC] Huge sysctl patch for the kernel coming - work in progress Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2014 11:36:41 -0000 Hi, Sometimes sysctl's default value needs to be setup at boot time and not when the rc.d/sysctl is running. Currently this is done by having two statements in the kernel: TUNABLE_INT("net.graph.mppe.log_max_rekey", &mppe_log_max_rekey); SYSCTL_INT(_net_graph_mppe, OID_AUTO, log_max_rekey, CTLFLAG_RW, I want to simplify this to: SYSCTL_INT(_net_graph_mppe, OID_AUTO, log_max_rekey, CTLFLAG_RWTUN, In other words if the existing CTLFLAG_TUN is set, the sysctl will automatically be pre-loaded with values from /boot/loader.conf. The reason we don't want the current approach is: 1) It duplicates the sysctl path in the TUNABLE statement. 2) It does not work very well for dynamically attached sysctls. There is a lot of code overhead computing the TUNABLE() path before the TUNABLE() can be fetched. Here is a work in progress: http://home.selasky.org:8192/sysctl_tunable.diff In most cases my patch is fine, but in some other cases I need some input, like in the VM subsystem when doing init, I'm not sure if the SYSINIT() for subsystem SI_SUB_KMEM, which sysctl's are using, has already been executed. --HPS