Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp77782rdg; Tue, 10 Oct 2023 05:00:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbvhiFOJV+SoX7lXY4irbCzgAf8jDM+5L9TRjc1l8dzmfh5xnTs4YulAhYSbfgkcZTyPs+ X-Received: by 2002:a17:902:c115:b0:1c5:e1b7:1c13 with SMTP id 21-20020a170902c11500b001c5e1b71c13mr16435934pli.3.1696939221028; Tue, 10 Oct 2023 05:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696939221; cv=none; d=google.com; s=arc-20160816; b=ckBGmwNTHzGI6RguWuNr8AOWoJolstDR34oq2U7Zc9cPq53gT4ArVYgqwTzuRZVvCM ntylwXIY1oJOt0B7LMIyLYi9asSHz8GYDxHgZtADxXvEnKHN3RsoFtnH0ScalQHNwmjN Il9a5pqJKoki6Ef7u/wNjTRz3yOo5lWlP/gX3bMYUyogITaxA+q/soVUjMjlcHTeytRg dY4AhP92UOZNkN0SzCQzT9WtZ7sIUNvOm8JgVoJU8zx061A80VTAxXstjr71crZxXcoM ah8me7RmKcZUs1IiLEGRfb8swVjNesGqo68HY52pTtA4pIoM4yGFgkn0/d4tTlxjL1gl greg== 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=fV6C3fWt60Cbw3teG3Z6moL8ZhM7tn0fWS6DTZOhWcw=; fh=9o1vzmbQvXEiiOZAoGEKGHmVR4Ieb6r+octdNZgYFWA=; b=Yx3tppQZ9d/hIUvVFn7Fw9zlKJEiJd8FhRSzpLlwDfHv6OnHdEiNK5DMvhJsByf42W o2Rx3gyrKxUwbS56J6gDadCBjB53bKHUxsCsaQG5pw3drn7wZi0dDNWc9OWRF7A1na1I f2dBlXXzwyQZ8Co7TI7lqHpYLU4gvpqJNBKmBoJ0xiUR6ohfRkTsVj1AwKiqq+8T3Rs6 PGOSGStqXr+5wdhl9UyVmdEXLwDYpPQRtdCubZxwoyqJLuRNJlK0zsR24QtGo+qq+UfM ZHOq6DfnrRcqUyiP1lLTI+5EF3dY2DayUMY/SEtAj8BXaiW+g5EQUyIrbjjg7bGTPlIE RKuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HBwTdFFy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id c12-20020a170902d48c00b001c62161b18esi12224375plg.580.2023.10.10.05.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:00:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HBwTdFFy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C4051801C21B; Tue, 10 Oct 2023 05:00:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbjJJL7l (ORCPT + 99 others); Tue, 10 Oct 2023 07:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbjJJL7i (ORCPT ); Tue, 10 Oct 2023 07:59:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A3EC94; Tue, 10 Oct 2023 04:59:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB2FCC433C9; Tue, 10 Oct 2023 11:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696939177; bh=kVkO+0yKi9ZpS4FWGCS7Kv5Nw6GETSxYizAFJIe2H3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HBwTdFFyikcuW6zjgSfptEjDuaNX/KFrnf74ZHK7pPfzVMwkyIIKaj9oWSk2/E1Mw qzrsA4SH6hh1k6jAeQgxbG5f8CegrVjWMOAu2/3NvqCLu3SM5cmoMn3m7X7BliNOV1 mSjXMW0J1MQTPZRVLQRHTMkS8is4YvN1D5/25QHSP+WK1kF+e5/awLb2TIZWFYie46 31yOjVFf0K4zwdXfPH8XL/ZN4hNirLQR1hDyHuyMSxQ5f1ZxFAIABoA7kmHmNU9r1r duPEUI6f0wTldpEc+jtNyF8KgqB8UsEUX+YskTygFENqU+v8QBNolufhMBXN/o3T4W GHYh5cZxb3rsg== From: Frederic Weisbecker To: LKML Cc: "Paul E. McKenney" , Boqun Feng , Joel Fernandes , Josh Triplett , Mathieu Desnoyers , Neeraj Upadhyay , Steven Rostedt , Uladzislau Rezki , rcu , Frederic Weisbecker Subject: [PATCH 01/23] torture: Share torture_random_state with torture_shuffle_tasks() Date: Tue, 10 Oct 2023 13:58:59 +0200 Message-Id: <20231010115921.988766-2-frederic@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010115921.988766-1-frederic@kernel.org> References: <20231010115921.988766-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:00:03 -0700 (PDT) X-Spam-Level: ** From: "Paul E. McKenney" Both torture_shuffle_tasks() and its caller torture_shuffle() define a torture_random_state structure. This is suboptimal given that torture_shuffle_tasks() runs for a very short period of time. This commit therefore causes torture_shuffle() to pass a pointer to its torture_random_state structure down to torture_shuffle_tasks(). Signed-off-by: Paul E. McKenney Signed-off-by: Frederic Weisbecker --- kernel/torture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/torture.c b/kernel/torture.c index b28b05bbef02..68dba4ecab5c 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -520,9 +520,8 @@ static void torture_shuffle_task_unregister_all(void) * A special case is when shuffle_idle_cpu = -1, in which case we allow * the tasks to run on all CPUs. */ -static void torture_shuffle_tasks(void) +static void torture_shuffle_tasks(struct torture_random_state *trp) { - DEFINE_TORTURE_RANDOM(rand); struct shuffle_task *stp; cpumask_setall(shuffle_tmp_mask); @@ -543,7 +542,7 @@ static void torture_shuffle_tasks(void) mutex_lock(&shuffle_task_mutex); list_for_each_entry(stp, &shuffle_task_list, st_l) { - if (!random_shuffle || torture_random(&rand) & 0x1) + if (!random_shuffle || torture_random(trp) & 0x1) set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask); } mutex_unlock(&shuffle_task_mutex); @@ -562,7 +561,7 @@ static int torture_shuffle(void *arg) VERBOSE_TOROUT_STRING("torture_shuffle task started"); do { torture_hrtimeout_jiffies(shuffle_interval, &rand); - torture_shuffle_tasks(); + torture_shuffle_tasks(&rand); torture_shutdown_absorb("torture_shuffle"); } while (!torture_must_stop()); torture_kthread_stopping("torture_shuffle"); @@ -673,7 +672,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void)) if (ssecs > 0) { shutdown_time = ktime_add(ktime_get(), ktime_set(ssecs, 0)); return torture_create_kthread(torture_shutdown, NULL, - shutdown_task); + shutdown_task); } return 0; } -- 2.34.1