Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp340772rwl; Thu, 23 Mar 2023 17:20:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Z3lKRRZWBh6oWZGJ6/q1YO8sDfWWu7epIm8Iuf4LoRzQVYIgOBe2lSfrwBfDPhX+sUOSUp X-Received: by 2002:a17:906:d1cf:b0:8b1:7aaa:4c25 with SMTP id bs15-20020a170906d1cf00b008b17aaa4c25mr817657ejb.29.1679617254304; Thu, 23 Mar 2023 17:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679617254; cv=none; d=google.com; s=arc-20160816; b=p9BC1yDbyzUHudutiScEl9oD+aSv2q433aGZRGwl1xryfhBvabG74i7cNBMXL+fOYI 87WkP/kMj3LscyWGq7lmUZbqZBoWT9EJkIUXccaMs45/kBBsAWjmkaG7oT/xDC2+QWlQ 4QDm3mUFvuZtTUaAy96m4LnKINo3wUJbvvj2hHxg7PY3bMz/Pbzp+dMo3v1cDsr3/nN0 MRigbVRp/HxSiCtbG28wxJSUu7Kkdf6QOXHujkklE/6d9chX57nuK3y1cRXtTcIywZSc sQaBhipnbLwBHARVmNwHugiljwMok8mkX8B7ROR05kAN0BcaFlFuoM/HDHq9p9qo07Av 8Reg== 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=aF85cbbUyN0T72a2IKMtmWipCcHZd8Ak9Drq2lz8wd8=; b=WbnPi1xAhaN7AsoWG2jA3WOf/46ZM6hILu9gohVCc7b2bdkd08UXjQ0gdTNwQUsDm5 10XBQlqtuSn8+Q80JRHtdqgl9UcxzabLjwLOGSFUFwLEMNotHuxl2WbF4TzYDSHHiWHD DvcyXyfTyh//fkdoaG46YZ7KiFQxAeoh7H0KC5RUk7VLP/GXqSJtcEnPznvplUX9EiXq eB+2z0CO705kjvT2B+A8qOBADuumj1h0hEDI+iZsd50FmBPn9EL/xlC61XwrXTP6Kkom 7zEi1BEzRIKXM7V0il3/E1eZ3b4U4Xfb9Sbqnm8ycqU+jdiu9GnJ1ttWv5tV6DojAp8W MHkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g2MtUvvi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr19-20020a1709073f9300b0093549a153f9si14749829ejc.912.2023.03.23.17.20.30; Thu, 23 Mar 2023 17:20:54 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=g2MtUvvi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231448AbjCXAUF (ORCPT + 99 others); Thu, 23 Mar 2023 20:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbjCXATs (ORCPT ); Thu, 23 Mar 2023 20:19:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC922DE65; Thu, 23 Mar 2023 17:19:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7AE6D62929; Fri, 24 Mar 2023 00:19:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F2EDC433AC; Fri, 24 Mar 2023 00:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679617181; bh=l0KonFEulcToOd8dBD5wwjfw4yz2wDL/Nm7i9FpxVDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2MtUvviljmMLyxWmLKa7HWhACub3Fq+C+FCDyUL3exH403jVAko+RiNnT+MSoeSA hdgLtw8nTREUcp/jiVtKghd59cNElVIEuheqai2P/89fE+MKi/jkuRvRNTtvdc5uVG EDU1VrQ0WwAP47aALarNeAxnFSP3hb1IF5nlIC9kCcMyK62oYpo4Q5prVnJj/PXwqK jRxnd1oe2HX1jBe0UpNZlPWMDKnpvXum11E/j0yWOQTTCSSVeuko8ZzHpfuVuZItWM yhdOAzVsBDz34dPt18MRUFcppImxkTd2xcliH7x8Aum+dx4tAMSJiVmCybbkW1FtV0 A5jZBKkwGbV/w== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id B311615403A5; Thu, 23 Mar 2023 17:19:40 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, hch@lst.de, "Paul E. McKenney" Subject: [PATCH RFC rcu 12/19] srcu: Move ->sda_is_static from srcu_struct to srcu_usage Date: Thu, 23 Mar 2023 17:19:31 -0700 Message-Id: <20230324001938.3443499-12-paulmck@kernel.org> X-Mailer: git-send-email 2.40.0.rc2 In-Reply-To: <3db82572-f156-4a5d-b711-841aa28bd996@paulmck-laptop> References: <3db82572-f156-4a5d-b711-841aa28bd996@paulmck-laptop> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 This commit moves the ->sda_is_static field from the srcu_struct structure to the srcu_usage structure to reduce the size of the former in order to improve cache locality. Suggested-by: Christoph Hellwig Signed-off-by: Paul E. McKenney --- include/linux/srcutree.h | 2 +- kernel/rcu/srcutree.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 82d07466da93..ca48b97d9f3b 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -76,6 +76,7 @@ struct srcu_usage { unsigned long srcu_size_jiffies; /* Current contention-measurement interval. */ unsigned long srcu_n_lock_retries; /* Contention events in current interval. */ unsigned long srcu_n_exp_nodelay; /* # expedited no-delays in current GP phase. */ + bool sda_is_static; /* May ->sda be passed to free_percpu()? */ }; /* @@ -84,7 +85,6 @@ struct srcu_usage { struct srcu_struct { unsigned int srcu_idx; /* Current rdr array element. */ struct srcu_data __percpu *sda; /* Per-CPU srcu_data array. */ - bool sda_is_static; /* May ->sda be passed to free_percpu()? */ unsigned long srcu_barrier_seq; /* srcu_barrier seq #. */ struct mutex srcu_barrier_mutex; /* Serialize barrier ops. */ struct completion srcu_barrier_completion; diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 3f389b3a25aa..7c192f7fb559 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -252,7 +252,7 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static) mutex_init(&ssp->srcu_barrier_mutex); atomic_set(&ssp->srcu_barrier_cpu_cnt, 0); INIT_DELAYED_WORK(&ssp->work, process_srcu); - ssp->sda_is_static = is_static; + ssp->srcu_sup->sda_is_static = is_static; if (!is_static) ssp->sda = alloc_percpu(struct srcu_data); if (!ssp->sda) { @@ -265,7 +265,7 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp, bool is_static) ssp->srcu_sup->srcu_last_gp_end = ktime_get_mono_fast_ns(); if (READ_ONCE(ssp->srcu_sup->srcu_size_state) == SRCU_SIZE_SMALL && SRCU_SIZING_IS_INIT()) { if (!init_srcu_struct_nodes(ssp, GFP_ATOMIC)) { - if (!ssp->sda_is_static) { + if (!ssp->srcu_sup->sda_is_static) { free_percpu(ssp->sda); ssp->sda = NULL; kfree(ssp->srcu_sup); @@ -667,7 +667,7 @@ void cleanup_srcu_struct(struct srcu_struct *ssp) kfree(ssp->srcu_sup->node); ssp->srcu_sup->node = NULL; ssp->srcu_sup->srcu_size_state = SRCU_SIZE_SMALL; - if (!ssp->sda_is_static) { + if (!ssp->srcu_sup->sda_is_static) { free_percpu(ssp->sda); ssp->sda = NULL; kfree(ssp->srcu_sup); -- 2.40.0.rc2