Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2656468pxm; Mon, 28 Feb 2022 03:41:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEnP0DV13mixdhhmRmZGRpQjYf4tA8cqblfXGg6XgW9YUun6thgAxDtyB05dsHndJQQRkR X-Received: by 2002:a17:906:714c:b0:6cf:4850:52cc with SMTP id z12-20020a170906714c00b006cf485052ccmr15012297ejj.319.1646048469744; Mon, 28 Feb 2022 03:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646048469; cv=none; d=google.com; s=arc-20160816; b=u8g0rXxv7DSKL76S7mzfP7bO3+bvqs8K1CbDOe3I6dv5ZWsR9gwTq7ZlmcBbt82bTY G2PIbdCTXJre+qfmBfNcUoZKU/b+w+jUbnxLtnAaObwdt2tCj3xHxuwRtjDOI9opReUb YyKEXJIh64+SjhB+f79naBftu42WXQjogeVelacLqCoYkiTLn+QQjlOBBG5isXdY8HSD DQI6UQRS1pXlywcwYSoif0wFBLJp8KDKI2PWOIvwedrlsa9P3dGM2zChHwfvR2fJMp1H BJMlAfxgAJkLTIHQPPszU4uezrmWdu1h+zexPnXqOUWIBPpOThZYAtfMOBCGIAiY24ih ZLVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6H6PLOlODlELuUrXrCLYoGeXhxxcGUB9kEy/fShHjn4=; b=cpBnHi32bYS0LsZrMc0552m2fo7Og1xU3YaLj0R/JGwOrAz9d0EabVCR2w80tn8qGm rxaCwwXieZGPwi9Nli4fbwgsxfj+KbP5xi/9pszgzWYdDhG0ih4W5oIqQYR95bziD3f6 430eFNToanI1pfTARscYt7PqGRtoqyQPEf37E3ohZ7XmyHfrCLn9WlsMHXmOMC6TNsoF tlBrBo3SQNLoSxcwqDw5BtqaxI9t9AP9odvbUd9gHt/LETQRO7e+c8T+jH3ZazsfGNax Kd74hs0wzs5EPWcEOmHgswJgy/eJjGGG5TT8fQvff6SdRRTC1pWtUP3Li/I0i1/Wa01+ gheA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=yuJj80Qe; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a170907272200b006bb5c06256bsi5535036ejl.599.2022.02.28.03.40.47; Mon, 28 Feb 2022 03:41:09 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=yuJj80Qe; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233612AbiB1HMU (ORCPT + 99 others); Mon, 28 Feb 2022 02:12:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233595AbiB1HMO (ORCPT ); Mon, 28 Feb 2022 02:12:14 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EDBB673F4 for ; Sun, 27 Feb 2022 23:11:36 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id l19so10294437pfu.2 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=xqQ35iWTrd7Z3qgrDjAe8yMvrM6R8XBc+jE530Dgk7pBnyLBa0HEAkamHi4CTMcwfK O6qfsLOW8eL/OeGPw7x5nIRHURQDtRV+zpUF3sdM4DyD2aGmi8UBaJrX+pXUT+uE5/Hq 2f20WRfjE//z0xs4amkvWgF4vBZZOgxMT0W3v5cvicFiPKqGLU+AOXG5g8QpvdQeZH7M GUfKRbHT058tOhJKhtPr1XusK2Ewwxk6zF34ofO5jrM0eBR/oOUVApL+eQK/EEBfBxAw Y3RZtZno2AarcIduKv8gmwjufDyvlFyWLvD6GBnwMfFBLbIj1FfTRJPp2+mlWvHr2pzK n2fw== X-Gm-Message-State: AOAM531H8iqU8sR9wLtfHehCifFdsFdttiH4YHhpZzSlwqrIXYNY0XnU r/BfEI3QwiFWmma1XqYw5OYzxA== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, 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 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, }; -- 2.11.0