From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24B1D3C81AD for ; Fri, 26 Jun 2026 07:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.208.54 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782457543; cv=pass; b=O8G+wb4qzhImiC49Ibd/ay9x3iQeGICV6tx8fmWNtRCLPmFem1ZZSLAeVrnIPDpI4jMU/Paz/KSU7Jue23Yg/58dbzI57MUrJxPNxe9SOEEi0wVRVE6egt84PIdonQrO7FwrlYGRsIAEGG3SIRi8i5f2dNfugptCtMSVCvMn7gk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782457543; c=relaxed/simple; bh=OSHs0S62N/i0LjCM4zXbLB7mXmcNMmfqk7GDffeKG+o=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=tX3BHKzzmFNJo4VopP3DyHGopUc5iN97yrTfsVfEztV/aZKFlaFx7Zai4VwEdKNoW9ZkBu+6CMUjkj/GdeuGM8cIKs8u0ioWRxQmq2DcQqCikz8dDnaKRhnF8S2e3Rjx7hDiUPdtxR1/KxY3K2xjELofxVpf128Onr5L/F3l/Zw= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VCLS3CXk; arc=pass smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VCLS3CXk" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-69806f118d1so918818a12.1 for ; Fri, 26 Jun 2026 00:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782457540; cv=none; d=google.com; s=arc-20260327; b=HWMULyk7oOwBCg9Qys9tViYS7qBQ/wtZLfkUih0f4vZCpkm7gK5Jhss48oRsre0Bnd 8ASIUNME1+IWX98aXXJi+panvX+mZwqQWPMfYrQpseDb9P1Nzok2LCdhZP+U/IfmCwHW mjxlBZVgOQvxSy7lD/km1S1QPHLKbb0Q2TMbA7qTL8z9r/lh3ASp14ywTIMyvxgJ7fRw 7TyAXKkQzqCzxa5X9fnJmKjPdEJmWdbl6PxGI0kkdY9RHzsKmTN8uKgKYz+S2W8yiGEx H0qmNWPy+HEtvF4nIyrQl4GzLUHBXHwho6MpIIUP8yrGqjGrJyNVjgPCYukvrL8o3H00 /oZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=zWxQ2JPKcx7st8ugpsqS6FjUcZOmnDgLGGpG7c5wPVs=; fh=5ij4FAXghWVEtEGZ9zJIASM9FZdTlpVkbga/+JyW9TA=; b=ha7qS4wreOjPZi3jlnNsi0tB9x/NS5M2YDFjPdPKDkIllhUKY2zTOWpv3sOPZ5VnK/ NnL9BGba3m75yKMWECKS7/sXjrnOfg1KK37g1oKuyixuvj4FsPPWzX4QPZqBsPtnTpU0 06Dw7gb1D4qKOIsQQY3HeUeaFFlnAUmHJG2G20UBXowkKRdhMPHT+M4eN+pKcwl+R3HZ 43r2rA8My/1lNaq3Q/xG/bierab7VHx9jrYe1xORUzqhwAMWJTgqB96WDgh8jwObBIAG O7gN8DN6+5BPio9sLOuNsOLyCTXuQren6AWRattwYbCLrw6K7KpfTxITd9L9U56f/fkW IOfw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1782457540; x=1783062340; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zWxQ2JPKcx7st8ugpsqS6FjUcZOmnDgLGGpG7c5wPVs=; b=VCLS3CXkNBEuwuzdHAI0Zj7xalzhU8HlZltnPK0woCsczQpcKpQYoHqlw2BP41/EC+ lmUFWgtX09N44+s5vR0jY4ZKNUINvb/dK+ZXFAekhH1Uf/dQy9weJP5aLqCuo1xwm8NO MbTCVTpOMW/6jdX2qxS/2stv3COZsIh1abJJpNCbfAKpVzETGeyZberSpaN11Tila3yW sPNqHtCnAOvKitgrCe0kewt7oDCRlPtms+LviNUPc0xEGZYONl/Iwf8hZfX8ZXWruTSd prANQ4Gmi8AnCQO60uG+vfjnlmQxGnipne4r+yfCwZdBzkM/TIPO2wxRSp6vnS3T3jql Gf6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782457540; x=1783062340; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zWxQ2JPKcx7st8ugpsqS6FjUcZOmnDgLGGpG7c5wPVs=; b=gaqoHtHRUCXP1axPqvswkqjyBwU7ATSSZGJlQ6LTwmnPlBeibilbpCdZRppCkxea8h wHRmN1WdLEf3s+NbfDzqKMRbt23bA+b35NKj7kS+dNFiQV5JpT2t9ufpCyOn8TEB29tu KfFFILhA/ZvzxWNNCJOummMkBeO5LQqZQkG7zg2rEQ7/OMgpVBuBzlCa5eNseg6cXWAQ 8jT5wHHxllVIckyISyK1xIPRNHPS+lK+Lgbr8P9+3psUPLdTNDR7X0MnkYdnRMnUbqpa P4rS6ROzvkC2ugRSXnCp+VmZjrHgzkaboKQ/KoltOTYAaqUug1CaKErEc+ukZjlV6nqj AAeA== X-Forwarded-Encrypted: i=1; AHgh+RoRWamdY/TdNmhYGGJ0KF+LuqV2WHg4Jpx9sLb80HuXqnpPX5xwMlTCZ7PZDNsPcn8znzguf0UcPq5IWUc=@vger.kernel.org X-Gm-Message-State: AOJu0YwXLAmc6Ig1tyaGg9wuY3GbVFKW4xUlk/DNvrbU1tpHCD892tf7 RYKH5Wcsq3/knKZb9GyKpe664U36YYnfyCubZTxp9cqAxZ5rFpe8GcdyV1/BRnXlNplTM0EUmkm 3KfN5UMUMtLPzXyck7p99iIhepRCl3PLmNbYooFI5rQ== X-Gm-Gg: AfdE7cnoSQ8CX7kMoLaQJpyLZq1E7SGIuv7dyxp9Q3qdDLn3ehBEinlDlnAzsGcXpYH kXG5mgGFaMi+eQEwVOPYWnbnMJXq5+MbJ+TBthJPCob+AHjC+85fBPUpJrsKL4IRpNiIOUFG1os 2y5z0suT6JyFghwSeNwm+I74DTSLkWRHzrdewHtGR4bO4jfClHZrH6WVq9HKKmGNeb58GknE8nQ Ba+ZeqGqbLUU+ys99dZfujHOL8hAdNTkz25tCpPld9InbVsD7wC9ooAH3gEtw6FOJlWK9X/eozq /dRG48a40lgplG9/45lukbLN8g== X-Received: by 2002:a05:6402:510a:b0:697:e953:d14d with SMTP id 4fb4d7f45d1cf-69810ac6f9amr1336023a12.17.1782457540459; Fri, 26 Jun 2026 00:05:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260624151229.1710703-1-vincent.guittot@linaro.org> <20260624151229.1710703-7-vincent.guittot@linaro.org> <613c1bde-4152-493f-b103-f1fda035b4af@amd.com> <20260625083720.GR42921@noisy.programming.kicks-ass.net> <20260625100957.GA2568396@noisy.programming.kicks-ass.net> <20260625222843.GE1181229@noisy.programming.kicks-ass.net> <9a7608a5-d164-4b1c-93d9-6a7431b7a896@amd.com> In-Reply-To: <9a7608a5-d164-4b1c-93d9-6a7431b7a896@amd.com> From: Vincent Guittot Date: Fri, 26 Jun 2026 09:05:29 +0200 X-Gm-Features: AVVi8Cd4rVHPms-o_ruWocW70FB9n0yXtZjJ4DeGtusFPPeYNjZ8H7ybvEZeTxw Message-ID: Subject: Re: [PATCH 6/6 v3] sched/eevdf: Speedup short slice task scheduling To: K Prateek Nayak Cc: Peter Zijlstra , mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, qyousef@layalina.io Content-Type: text/plain; charset="UTF-8" On Fri, 26 Jun 2026 at 05:57, K Prateek Nayak wrote: > > Hello Peter, > > On 6/26/2026 3:58 AM, Peter Zijlstra wrote: > > +static u64 ineligible_vruntime(struct cfs_rq *cfs_rq) > > +{ > > + struct sched_entity *curr = cfs_rq->curr; > > + long weight = cfs_rq->sum_weight; > > + s64 delta = 0; > > + > > + if (curr && !curr->on_rq) > > + curr = NULL; > > + > > + /* > > + * This is called from set_next_task_fair(.first=true) / > > + * set_protect_slice() so curr had better be set and on_rq. > > + */ > > + WARN_ON_ONCE(!curr); > > set_protect_slice() is indeed called from set_next_entity(.first=true) > but it is done after __dequeue_entity() and before "cfs_rq->curr" is > set (both sched/flat and sched/core have the same pattern). Yes, I confirm that set_protect_slice() is called before setting curr in tip/sched/core but I think that Peter added flat hierarchy patches in his tree > > You should be hitting this splat very easily unless you have moved > set_protect_slice() after the setting of cfs_rq->curr in your tree. > > > + > > + if (weight) { > > + s64 runtime = cfs_rq->sum_w_vruntime; > > + > > + /* > > + * Do not add @curr to obtain the effective '- w_j' terms. > > + */ > > + > > + /* sign flips effective floor / ceiling */ > > + if (runtime < 0) > > + runtime -= (weight - 1); > > + > > + delta = div64_long(runtime, weight); > > + } > > + > > + return cfs_rq->zero_vruntime + delta + 1; > > +} > > + > > static inline u64 cfs_rq_max_slice(struct cfs_rq *cfs_rq); > > > > /* > > @@ -1058,8 +1119,14 @@ static inline void set_protect_slice(str > > slice = cfs_rq_min_slice(cfs_rq); > > > > slice = min(slice, se->slice); > > - if (slice != se->slice) > > - vprot = min_vruntime(vprot, se->vruntime + calc_delta_fair(slice, se)); > > + > > + /* If there are shorter slices than se's one */ > > + if (slice != se->slice) { > > I guess that condition was protecting a simple boot test but If I run: > > for i in 10000000 20000000 30000000 40000000 50000000; > do > sudo taskset -c 0 chrt -v -o -T $i 0 loop& # Simple while(1) loop > done > > > I see the splat: > > ------------[ cut here ]------------ > !curr > WARNING: kernel/sched/fair.c:858 at set_next_task_fair+0x1d1/0x870, CPU#0: kworker/0:5/3750 > ... > > > + if (sched_feat(PREEMPT_SHORT)) > > + vprot = min_vruntime(vprot, ineligible_vruntime(cfs_rq)); > > + else > > + vprot = min_vruntime(vprot, se->vruntime + calc_delta_fair(slice, se)); > > + } > > > > se->vprot = vprot; > > } > > -- > Thanks and Regards, > Prateek >