Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3634081rwb; Sat, 12 Nov 2022 09:22:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KkxeUQBibiDpQGUu55YJtVXTyY8CisMT9RKD9pAHOSWRX34Wz7FM5t67py/96K9qJwkJM X-Received: by 2002:a17:902:b7c5:b0:186:5eab:8631 with SMTP id v5-20020a170902b7c500b001865eab8631mr7349271plz.134.1668273736142; Sat, 12 Nov 2022 09:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668273736; cv=none; d=google.com; s=arc-20160816; b=X37KWLrBbO5eLtty5qPTGLMKHujbEDd3YErqSBXfRfkbs1UXbdDhllzNCMQF9lBxev oUEpIXyXVHxpsPOtHu//wQm9yKpS+dvilmfoFxxkzC9YkdPz1o62kuL1i37D/WedtlJK LcQMlCBiaCl7oS5UqIkVLQ3EJRoLw9hl5X0WSEVT0df67GARK7ep6j3xVD+tp0FtE6G9 fkv0U2cBOStaJt6eV8J9L8HyEznE46fq6QiPIsmKA4eTs9HcO21oFxA3TP4wCydnNh3T IZnmaR+AFhOZj9Lk6u7PwR7rE/tjufWoGYZswcThV7bA3dIgTEFZiDhFWrvq70oaUevg cu2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hraU6DavAv/OWYW8yya1aO+dvV0RLHvHKMFzF5tyCpI=; b=zUt7c6zDgC3S1j86L5jLUOiMFv4At+ewS/32en/dX/lt0rNSZDI1s3QtLLyEwgZS5b Tfh/nfFF9PU/yzQG7JVCbVTE6B/szEjCtycV12S/Y/wuLp4Z07yEIaOh/MWxCj+PadKN oS1HOqeFxpb3YbsyXpzIT2LOyGPtf4HJKgS3nWwHOSeIQouGaYD/rFPWF2oMqKshFyds Hl6CPPpVPpJWH4WMPUzyfPF/weqzSCqXZFDSnQeXVjuotqML5aQzJjHa/c9zHYyisl4O LSVKr7yNRqrytoHkPX1BSdyOfrCNZb4iBRsHHQwJW5jCHVOQz6q4apgxdl4BzStTNTPv /+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=sF14r4gr; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a170902dacb00b00186b069c0e1si6126325plx.282.2022.11.12.09.22.04; Sat, 12 Nov 2022 09:22:16 -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=@joelfernandes.org header.s=google header.b=sF14r4gr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235028AbiKLQzR (ORCPT + 90 others); Sat, 12 Nov 2022 11:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232659AbiKLQzN (ORCPT ); Sat, 12 Nov 2022 11:55:13 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF6C3E44 for ; Sat, 12 Nov 2022 08:54:55 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id d8so1853403qki.13 for ; Sat, 12 Nov 2022 08:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hraU6DavAv/OWYW8yya1aO+dvV0RLHvHKMFzF5tyCpI=; b=sF14r4gr7Rfsa5jIETwbsJIHmxlLNsTNWfuqzgjtFZ7s7ATC7UZDYDjRaGHTyYJDiR bnR02OUYvRftYWJh1z4SihAYjyRuWZXQjMaQ4gKDi6nKTaRyfOLAEM1rtnKewDnA1ajd zUswt0Qk2++V9tyAFrJpiUkj3/BI2jp52QmSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hraU6DavAv/OWYW8yya1aO+dvV0RLHvHKMFzF5tyCpI=; b=JSTAhDQZuvcE6WpVDgxAKwBVLt1w53A32SKvviB0dYRbT+VWinRuBIf9FqEvyGPl5B M5PJYLtR17s/dsBpznestcklmh9DkUgiIXbBV5HHOEnET/e0Gk8BUm/HAsO5cnMmfjoC NIdaLYSpkoay22QYSF6PSMZCyqZgcNTZHNBiGtL+ziPonhG3q/9AT3HcDgK6Ue0+P/Lo zd21hSY0DDJRMw7MVYwOtFDlPWUX2kJ9jGFN6f3kAMSoqUw3T5Sk+9ckthNHyuacfTsT TqXBTBfPY9PRvx9RhMu5edq3zkqMSUgfUBxu0NbLhaIs4qSbN6yJ1zXFfHJKMK1bojws XCOQ== X-Gm-Message-State: ANoB5plyZUhh739oKACiUzjwEwvfMptWSetCfi/w4Yg1iS4UFFytTR/J fJ5bm9CVXQAxED4ZeoKKfYHqDQ== X-Received: by 2002:a37:6446:0:b0:6fa:16f2:7f57 with SMTP id y67-20020a376446000000b006fa16f27f57mr5387628qkb.221.1668272094772; Sat, 12 Nov 2022 08:54:54 -0800 (PST) Received: from localhost (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id v22-20020a05620a441600b006faac3c33b8sm3534120qkp.27.2022.11.12.08.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 08:54:54 -0800 (PST) Date: Sat, 12 Nov 2022 16:54:53 +0000 From: Joel Fernandes To: Connor O'Brien Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Subject: Re: [RFC PATCH 10/11] torture: support randomized shuffling for proxy exec testing Message-ID: References: <20221003214501.2050087-1-connoro@google.com> <20221003214501.2050087-11-connoro@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221003214501.2050087-11-connoro@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 On Mon, Oct 03, 2022 at 09:45:00PM +0000, Connor O'Brien wrote: > Quick hack to better surface bugs in proxy execution. > > Shuffling sets the same cpu affinities for all tasks, which makes us > less likely to hit paths involving migrating blocked tasks onto a cpu > where they can't run. Add an element of randomness to allow affinities > of different writer tasks to diverge. > > Signed-off-by: Connor O'Brien > --- > kernel/torture.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/kernel/torture.c b/kernel/torture.c > index 789aeb0e1159..1d0dd88369e3 100644 > --- a/kernel/torture.c > +++ b/kernel/torture.c > @@ -54,6 +54,9 @@ module_param(verbose_sleep_frequency, int, 0444); > static int verbose_sleep_duration = 1; > module_param(verbose_sleep_duration, int, 0444); > > +static int random_shuffle; > +module_param(random_shuffle, int, 0444); > + > static char *torture_type; > static int verbose; > > @@ -518,6 +521,7 @@ static void torture_shuffle_task_unregister_all(void) > */ > static void torture_shuffle_tasks(void) > { > + DEFINE_TORTURE_RANDOM(rand); > struct shuffle_task *stp; > > cpumask_setall(shuffle_tmp_mask); > @@ -537,8 +541,10 @@ static void torture_shuffle_tasks(void) > cpumask_clear_cpu(shuffle_idle_cpu, shuffle_tmp_mask); > > mutex_lock(&shuffle_task_mutex); > - list_for_each_entry(stp, &shuffle_task_list, st_l) > - set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask); > + list_for_each_entry(stp, &shuffle_task_list, st_l) { > + if (!random_shuffle || torture_random(&rand) & 0x1) > + set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask); > + } > mutex_unlock(&shuffle_task_mutex); Instead of doing it this way, maybe another approach is to randomize the sleep interval in: */ static int torture_shuffle(void *arg) { VERBOSE_TOROUT_STRING("torture_shuffle task started"); do { schedule_timeout_interruptible(shuffle_interval); torture_shuffle_tasks(); ... } while (...) ... } Right now with this patch you still wakeup the shuffle thread when skipping the affinity set operation. thanks, - Joel