From patchwork Mon Feb 28 07:10:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12762467 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 15F7EC433EF for ; Mon, 28 Feb 2022 07:11:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B9718D0006; Mon, 28 Feb 2022 02:11:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 967DA8D0001; Mon, 28 Feb 2022 02:11:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8578A8D0006; Mon, 28 Feb 2022 02:11:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 779FB8D0001 for ; Mon, 28 Feb 2022 02:11:37 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 325438249980 for ; Mon, 28 Feb 2022 07:11:37 +0000 (UTC) X-FDA: 79191318234.17.527955B Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf10.hostedemail.com (Postfix) with ESMTP id A32D1C0005 for ; Mon, 28 Feb 2022 07:11:36 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id o23so10618169pgk.13 for ; Sun, 27 Feb 2022 23:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6H6PLOlODlELuUrXrCLYoGeXhxxcGUB9kEy/fShHjn4=; b=yuJj80QeewJ2+adT1VdgjIVhQ6FRG5fnHsSu0frIUV2+jgz5s32ulViVic7VWe/w8B JbHJ3/v5Ykyq1Zju+8bFuuNvbWHQM2PGRjEmGZMFPBzzBpLDX1lsmlk223md9Xzl9mFd zV68wuqOqLAtIXKFGOZD4dFP2SM1fxjX/6Y8HiVq+IhJwRGVCcTJfP8QHOX7m076OAQE JA6/AgeQ0Pea2J3StVRYnW6zkowHDcMIi2W0ApNiSCZXyTKBh82GLmYttvWAioktT0g7 eRKw3nD0jNANDcoAi5rFrYM2UYMMRZ/0wnXqLXjUDLqn+PEZ1fplx7I9eFCxIDFv4EOW 89eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6H6PLOlODlELuUrXrCLYoGeXhxxcGUB9kEy/fShHjn4=; b=x4YU3ZaFkaAO/aTuJud0a8Vm+k2a9PtaN/WwPvMjV2s/IyPCdCoZTHXcLbhEK/ADu/ evKUBiNWaNlWXAmFAEaTMv1a1qyVWlvZrUqbigu0+VQNTndiBgEjheUJy2e7NGsIsKDE NQFt7T9yU4S8x+MGFo9G2rvFch0zc9VSfrA2oZW+0meZxHPs3dBNO/M5ulLHQkZlH0gz F4ywYv2pktY0PdK+ePvCcjOIV4fzWk1MU6nVAvAXKb+pxnWufHvsmkahuxvA450BR/Mw /OSwCaovDTWZCcTb+3T9H+pz5VmKWztQrS8/+7VA4OvyL/y85SD/EQFf55+PPGGuoWS/ NldQ== X-Gm-Message-State: AOAM533q/h9aiWvObnomIiabibJo6o+o32oN7M+YWtVU5pzFYwbvtE1O nNNam0jxhpXgeHj5/DgWmshBtg== X-Google-Smtp-Source: ABdhPJwvXcp5CL86BH67oNCcmHurbmKiXoJXFoBN4tPzC2nolXf9EU8whvLTaQsnxZ9c3gxr0Ef0LQ== X-Received: by 2002:a63:2204:0:b0:378:9f08:206d with SMTP id i4-20020a632204000000b003789f08206dmr3409181pgi.3.1646032295754; Sun, 27 Feb 2022 23:11:35 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id i7-20020a17090a65c700b001b936b8abe0sm16240390pjs.7.2022.02.27.23.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 23:11:35 -0800 (PST) From: Muchun Song To: corbet@lwn.net, mike.kravetz@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH 2/3] sysctl: allow to set extra1 to SYSCTL_ONE Date: Mon, 28 Feb 2022 15:10:21 +0800 Message-Id: <20220228071022.26143-3-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228071022.26143-1-songmuchun@bytedance.com> References: <20220228071022.26143-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: A32D1C0005 X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=yuJj80Qe; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf10.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Stat-Signature: ztnfmgpr8n55e5bja4k83m7zct3oy9oa X-HE-Tag: 1646032296-797861 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: Some sysctls only allow to be enabled and cannot be set back to be disabled. But proc_do_static_key() does not consider this situation, which set ->extra1 to SYSCTL_ZERO unconditionally. This patch add the ability to set ->extra1 to SYSCTL_ONE, which will be used in the next patch. Signed-off-by: Muchun Song --- kernel/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 64065abf361e..ab3e9c937268 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1631,7 +1631,7 @@ int proc_do_static_key(struct ctl_table *table, int write, .data = &val, .maxlen = sizeof(val), .mode = table->mode, - .extra1 = SYSCTL_ZERO, + .extra1 = table->extra1 == SYSCTL_ONE ? SYSCTL_ONE : SYSCTL_ZERO, .extra2 = SYSCTL_ONE, };