From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796137892; b=V6bP0+wgt1rOB7MUZtvoFlveJk8DLY8LHlrch0M+efINOMm2uo0ZYdjrcoaVeGSomfpG WuHyT2/hKWckOZvH5viwVs8l42hcoxJFRZRuSXHBlz46aZLHOgA7BtRyn9SYyAru/zecR ob+l/3mx/KrkNJeS1TqW+wZUj4NZOdEnZ5GBgVyglemAhFY2U0t8D+Rc9ZYDVznftEpBt fMLWxW6x9RLE3R/MrgJcWwi2jpp+u/PoPoX0D+RW6+/8VNAEKo2NaJyXVtNjneNzFuQLs ldAi7S8biZj0GYRfjAVyUQqE5lFLfjU0sJxMgXbhcxRz2JhnLz6LfWOG4iV4+RjTj/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137892; h=Received:DKIM-Signature:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=ecXm5d1v9gJyek0hDG5Y6LIJhEvNAYdn4m+JfSvmdmI=; b=V6JBLZ3Lp52X8gCGaMCmlNdo3jU3n30UOvO8UyWmsV3cHAZgaR17IA3FaTBN4msTGIRD i26udhlxouh55jfHH0PnslnzjElB2O08MtOGOU4CmU2j/sYoT9WqO6H5pn1/1MtI2SE66 dU0N6NnytVHsHGO73MppbrvOS3oVjSr1Xl7g22GQkGjM0jT68+cNfi1QxbpDNVtrQNnea h68Xv+bY8jeZ4xWJmgzV73z93Q9Iv8jdchbs7357xIR8l9d8S3eu3s9t9jcic2Pxozs85 bDqhZGXVhXeapTH0yaYo6nhMrm71VF82zdMLRJ9hT0qxnQZjNcnQLxCw60Xryq6QVTg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Exr9jIFU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6266D606A32D; Tue, 1 Dec 2026 15:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Exr9jIFU Received: by smtp.kernel.org (Postfix) with ESMTPSA id 785201F00893; Tue, 1 Dec 2026 15:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796137891; bh=ecXm5d1v9gJyek0hDG5Y6LIJhEvNAYdn4m+JfSvmdmI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Exr9jIFUO+XdTTa9BBwh4Wg083ZuFwXcTu/sQv81EmgkzlTFsCWEMagVzVfHz8VSE Viy3Ad18xTqw+E92NV1ky5NIFkm71vVOU9MSeu0jgrLD1TOgReOZ0KMybs3uSjDBk/ LBwmNGpExjHkE6EQpfdxeDPuyEhKlZeGxb6Up2xgGZymSjRSgn+3KPlfM1mbBE6cpa msFFOvlMLY9D7wWdL8E77axtsAPbOONIelvg/Z0f/MzNB17Pqhtz4S8rumgBeHZdPN PbmVCuPWnaaeE4ajs1XtodDn7DsCyX9uLQLI0yJq/ZrRJ/59W7KajDCx0kPn7V0+fj JKLQV7x6JDjyg== Date: Tue, 01 Dec 2026 05:11:30 -1000 Message-ID: From: Tejun Heo To: Kuba Piecuch Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Josh Don , David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] sched/core: Don't count voluntary idle picks as forced idle In-Reply-To: <20261201120123.3678974-2-jpiecuch@google.com> References: <20261201120123.3678974-1-jpiecuch@google.com> <20261201120123.3678974-2-jpiecuch@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Tue, Dec 01, 2026 at 12:03:03PM +0000, Kuba Piecuch wrote: > In pick_next_task(), the per-sibling loop increments > rq->core->core_forceidle_count whenever p == rq_i->idle and > rq_i->nr_running > 0. That conflates a sibling forced idle by a cookie > mismatch with a sibling whose pick_task() voluntarily returned idle while > rq_i->nr_running > 0. > > Voluntary idle with nr_running > 0 is legitimate whenever a scheduling > class keeps queued tasks off the CPU and returns NULL from pick_task(), > such as sched_ext tasks parked on a non-local DSQ. Counting those > voluntary idle picks as forced idle has two effects: > > - If all siblings pick idle (occ == 0), core_forceidle_count becomes > non-zero while core_forceidle_occupation is 0, triggering > WARN_ON_ONCE(!rq->core->core_forceidle_occupation) in > __sched_core_account_forceidle() when schedstats is enabled. > - If another sibling is running (occ > 0), the voluntary idle time is > spuriously billed as forced idle to the running sibling's cgroup and > triggers forced-idle-only paths (queue_core_balance(), forced_idle_rq(), > sched_core_idle_needs_pick()). > > Increment core_forceidle_count and core_forceidle_seq only inside the > !cookie_equals(p, cookie) branch when sched_core_find() returns NULL and > replaces a non-idle pick with idle. Since cookie_equals() always returns > true for rq_i->idle, voluntary idle picks are never counted as forced > idle, and entering the mismatch branch guarantees a non-idle @max so > core_forceidle_occupation is always non-zero whenever forced idle is > recorded. > > Fixes: 4feee7d12603 ("sched/core: Forced idle accounting") > Cc: stable@vger.kernel.org > Signed-off-by: Kuba Piecuch Acked-by: Tejun Heo Thanks. -- tejun