Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3164572ybz; Mon, 27 Apr 2020 11:06:57 -0700 (PDT) X-Google-Smtp-Source: APiQypKmW8Lw8hzbv+ys4B+YLZ/xPOQZfv/SkXOy/DFceeEhsx+pxOX8Z2WOgcu7n83DAP97A6xw X-Received: by 2002:a50:c0ce:: with SMTP id r14mr19110277edf.298.1588010816845; Mon, 27 Apr 2020 11:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588010816; cv=none; d=google.com; s=arc-20160816; b=kG3mWj1ShnnOVZzeD9JvbzTuy5sco+PxxTJgKhCR9Zgn0YZrgwOcs6yF+jtF8GOPsz 0UkrHpsGwRpx1wixiGjZNEL9MF/s9FbxNR++PtxyzdCB5ETetnu5YlHocQkkwmLvQOgR N5Hsua4oprMWjHy4is4qipiRGqv8qi7QhZ4tB0InPP4b1XY0JVqeTmzaNwCowGeGqD0C qUzQPL+cBICOIJo2NtciywyEC31e4iXnhy2S/NSwwr6kmeDVxVfQmwMuT92r4XwPqLeI STmxdvd0iux+Rq97lNYjSe+dBaTu0i1no/0ar4D7Ya9DtpwDf6ikVzH+LCC0Xo/oxMms IlsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=HU7Za9CIKDEFmnKhZN++aHZ6SpdUAGcOhxOfiKPjoXs=; b=b/RyDLgWiP6T6iX88P0BgxkeVIff4ISfm3zY9Ah6qklvWknbTKCYQxCu6YLnVV8/yZ GbPWumNwN+TL5lqZ12Okr92gHaCD7dweBAXAGnkIHttnKEdGXQN81QLN6HMAO9GP528w 05oS2sE5D6s2psQ+iQ2b1yPqvZVMpV2xjs2XPx1q1D410eo3ADCFq7Lu4SQyS34rQndM C5YRu2uBjrfuEs5kvpNwCBsgKtNlOsbtxXGbh9c3tW9JrmJJNZuWNLG6ESFb6o+8QvRC bybm+kL404ujmCXIbo9h/Kp57eQWj2kL2EW5kd1WyaBLGGJSTe/rd+hR4MucsIsawsQz g/KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si178569edi.466.2020.04.27.11.06.25; Mon, 27 Apr 2020 11:06:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbgD0SEw (ORCPT + 99 others); Mon, 27 Apr 2020 14:04:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:54612 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726306AbgD0SEv (ORCPT ); Mon, 27 Apr 2020 14:04:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EDA14ACC4; Mon, 27 Apr 2020 18:04:47 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton , Luis Chamberlain , Kees Cook , Iurii Zaikin Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, Ivan Teterevkov , Michal Hocko , David Rientjes , Matthew Wilcox , "Eric W . Biederman" , "Guilherme G . Piccoli" , Alexey Dobriyan , Thomas Gleixner , Greg Kroah-Hartman , Christian Brauner , Masami Hiramatsu , Vlastimil Babka Subject: [PATCH v3 0/5] support setting sysctl parameters from kernel command line Date: Mon, 27 Apr 2020 20:04:28 +0200 Message-Id: <20200427180433.7029-1-vbabka@suse.cz> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds support for something that seems like many people always wanted but nobody added it yet, so here's the ability to set sysctl parameters via kernel command line options in the form of sysctl.vm.something=1 The important part is Patch 1. The second, not so important part is an attempt to clean up legacy one-off parameters that do the same thing as a sysctl. I don't want to remove them completely for compatibility reasons, but with generic sysctl support the idea is to remove the one-off param handlers and treat the parameters as aliases for the sysctl variants. I have identified several parameters that mention sysctl counterparts in Documentation/admin-guide/kernel-parameters.txt but there might be more. The conversion also has varying level of success: - numa_zonelist_order is converted in Patch 2 together with adding the necessary infrastructure. It's easy as it doesn't really do anything but warn on deprecated value these days. - hung_task_panic is converted in Patch 3, but there's a downside that now it only accepts 0 and 1, while previously it was any integer value - nmi_watchdog maps to two sysctls nmi_watchdog and hardlockup_panic, so there's no straighforward conversion possible - traceoff_on_warning is a flag without value and it would be required to handle that somehow in the conversion infractructure, which seems pointless for a single flag Vlastimil Babka (3): kernel/sysctl: support setting sysctl parameters from kernel command line kernel/sysctl: support handling command line aliases kernel/hung_task convert hung_task_panic boot parameter to sysctl Changes since v2: - rebase to 5.7-rc3 - add acks - add a testcase to tools/testing/selftests/sysctl/sysctl.sh - this adds a new sysctl parameter ../boot_int in lib/test_sysctl and expects the tester to pass the respective boot parameter in any feasible way (including bootconfig) the testcase checks /proc/cmdline to distinguish real failure from the lack of parameter. That allows us to test this without introducing further new functionality (patches 4+5). Vlastimil Babka (5): kernel/sysctl: support setting sysctl parameters from kernel command line kernel/sysctl: support handling command line aliases kernel/hung_task convert hung_task_panic boot parameter to sysctl tools/testing/selftests/sysctl/sysctl.sh: support CONFIG_TEST_SYSCTL=y lib/test_sysctl: support testing of sysctl. boot parameter .../admin-guide/kernel-parameters.txt | 11 +- fs/proc/proc_sysctl.c | 142 ++++++++++++++++++ include/linux/sysctl.h | 4 + init/main.c | 2 + kernel/hung_task.c | 10 -- lib/test_sysctl.c | 13 ++ mm/page_alloc.c | 9 -- tools/testing/selftests/sysctl/sysctl.sh | 42 +++++- 8 files changed, 210 insertions(+), 23 deletions(-) -- 2.26.0