From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796126587; b=bOjuogPhE+3UaCuHCUn/CxBa01twNCzCfctnPZZoiN9dFKpi+sXIbAUCWogSPICSC8kk p9D5i1bOzRI7tt37DIH1PyrlTMe/ykGIrE15K/Nmyhj+ZtfATDNM9OzHci02Xi7XFtM5y aiMbRxYn8gYLSZBFhMbccUV9Ed+OjRI54qEE1yD3NkAryGjy5DjgTxS21lhIP0vm6NWGC rkB503CMkvSA3qOXtie6zmXRFCw2my7aYtadWT70ccYjQ4uXP8orCPGX+oiHz0E+zXzNt NowND0bWC5mCxFS/zYEjG9zeN/QrGRk6LIpEinI1QWQ3UVDDCmvR1Hfo9nJZjULuQag== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796126587; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=djL8EB98gwC1yMC5g/VrBLEBvvkhNifU1t0looozubc=; b=I0Rnx8oUht+TdAEfWcIANhYsUk/fM6kLRi99lWvWvvQ5SOEdgRoKnizF5KR89hqzg62s f1eWe2RcOtqxBkeG2gg10mbAp6D7XBHRwqXsk+cOLbGKtUNtn8tpESAZxBWqOtyVGpqGR XtnZwBzru5uuqX+7WgKB2sj/GgSGJrw9tckN4ZCO7R/4njrn0laRPoWN6rNjBq9Qqqdix pnUuVw7xwmARFHQ63FbQACAS6S/KB/ttTbNbUltsFk98YAEWuxVtrD+v5TBm/62m+qSbx Fh59cRRS56eqIsU7K4+sc5gZB5b1RN7WsGBa9hFkOyCGzY3pblcRTZTJ4/ON8FIMEdg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=l6v5R+T8; arc=none smtp.remote-ip=209.85.221.69 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F7A3606A32F for ; Tue, 1 Dec 2026 12:03:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F7A3606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=l6v5R+T8 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4ab855a8c21so9447351f8f.1 for ; Tue, 01 Dec 2026 04:03:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796126586; x=1796731386; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=djL8EB98gwC1yMC5g/VrBLEBvvkhNifU1t0looozubc=; b=l6v5R+T8Bjy1d/4koOuYnnX2syueXe81aueLZ0o0YCu9mBW1zOKcodbeteAlcDxu5K b5gIXj2KcxbvhEQKEeDv+u7AdQkK0Wpryss2YaxhZ8b5LRVnAyLtFwXda+DM6e0JE64O HfjaiHFwEC6Eh+P1iQiNwBigAvnFNNwGh8I7UZ4dmlIObrbWAvOw5TqFXsEH5N8JWhLq CNPg8/wxpg94JOtpKiBwCW6216r+0ZqzdCizvjrkbpBAcJzHx7GY7lJaXlYYNeqA1ozw 1NiGn1pqtRpGE0VqzEQKJHtNIUwYDH1gWDJ53GpFieGg8J2SgBKVEHHbLB3/QaqJ98MR zAEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796126586; x=1796731386; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=djL8EB98gwC1yMC5g/VrBLEBvvkhNifU1t0looozubc=; b=qaIWLWJtakq78jq5buWz4fW4w7tbnC2h44zoUb7Tw9Mmg1p1qTpTb9u6S7wJej7vAP 1WjFl23zCIAghmOsEzgVVyI3YS9RXVMu8z/enxFWaQx78Z4Y9USt7jaThGccdzEFz2Lr Oa5XRtNOvlrlJc1XfUoGQklQtVmgHvjGmwJQLSmQVNbNogipQhESSOhB+nYGK22G804N qK53NuuApTNu1qcXu2HjhnjnMgFIgtIYPSPXL2MWB6PzPRs8z5OX1K3a1jFI9zAhzy1Q nD4baTwp25SZ6oXBJM5hjoktiL5VJE5C0ef5Kul3nRHtoOOPdyUurfqi4O18Y3RW3agm hq6A== X-Forwarded-Encrypted: i=1; AL+hErEihIx7a57uM8JChSwGufmJvxZ+aUukDCqDkEitmowWK01joCyia0Lt6TWqejL3VS7FIRP/VnG5QO32AAg=@vger.kernel.org X-Gm-Message-State: APuU4Z8Dkj0I+0h1Mmj7OBE2pTzE01pSMYzSAk9n9zSGtNpc6/S3jicU RVwwypv4TLQkaDhFEeLibuhb4hJWXQBNi5rz4pSphPYwQGdZ/KlPw+WTPqluiBZ6U2ZZngq9NZ1 NPof/G9ibrBRpbg== X-Received: from wrnx18.prod.google.com ([2002:adf:ec12:0:b0:4ac:bfdb:6808]) (user=jpiecuch job=prod-delivery.src-stubby-dispatcher) by 2002:a5d:5f86:0:b0:4a5:ba8b:e00e with SMTP id ffacd0b85a97d-4abb4f5a324mr68986442f8f.45.1796126585380; Tue, 01 Dec 2026 04:03:05 -0800 (PST) Date: Tue, 1 Dec 2026 12:03:02 +0000 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 X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261201120123.3678974-1-jpiecuch@google.com> Subject: [PATCH 0/2] sched/core: Don't count voluntary idle picks as forced idle From: Kuba Piecuch To: Peter Zijlstra , Tejun Heo Cc: Kuba Piecuch , Ingo Molnar , Juri Lelli , Vincent Guittot , Josh Don , David Vernet , Andrea Righi , Changwoo Min , sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" In pick_next_task(), core scheduling increments core_forceidle_count whenever a sibling picks idle with rq_i->nr_running > 0. That mistakes a voluntary idle pick -- such as a sched_ext task parked on a non-local DSQ while pick_task() returns NULL -- for cookie-mismatch forced idle. When all siblings voluntarily pick idle, core_forceidle_count > 0 with core_forceidle_occupation == 0 triggers the warning in __sched_core_account_forceidle(); when another sibling is busy, voluntary idle is billed as forced idle and triggers forced-idle-only paths (queue_core_balance(), forced_idle_rq(), sched_core_idle_needs_pick()). Patch 1 moves the core_forceidle_count and core_forceidle_seq increments into the !cookie_equals(p, cookie) fallback when sched_core_find() returns NULL. Patch 2 adds a core_forceidle sched_ext selftest covering voluntary idle with an idle sibling, voluntary idle with an untagged busy sibling, and a sanity check that genuine cookie-mismatch forced idle is still counted. Without patch 1, the selftest triggers: WARNING: kernel/sched/core_sched.c:262 at __sched_core_account_forceidle+0x23e/0x260, CPU#0: swapper/0/0 and fails with: ERR: core_forceidle.c:449 Phase 1: voluntary idle counted as forced idle (obs=1 fi=1 zero_occ=1) This series is based on tip/sched/urgent because commit d2583cb03113 ("sched/deadline: Clear stale rq->dl_server when core-sched replaces a pick") modifies the same loop in pick_next_task(). Patch 2 touches tools/testing/selftests/sched_ext/ only; please route through whichever tree is more convenient (or take patch 1 via tip and patch 2 via sched_ext once patch 1 lands). The patches were written with the help of an AI coding assistant. I have reviewed the patches and verified the tests run by the tool. Kuba Piecuch (2): sched/core: Don't count voluntary idle picks as forced idle selftests/sched_ext: Add core_forceidle test for voluntary idle picks kernel/sched/core.c | 15 +- tools/testing/selftests/sched_ext/Makefile | 1 + .../selftests/sched_ext/core_forceidle.bpf.c | 176 +++++++ .../selftests/sched_ext/core_forceidle.c | 490 ++++++++++++++++++ 4 files changed, 673 insertions(+), 9 deletions(-) create mode 100644 tools/testing/selftests/sched_ext/core_forceidle.bpf.c create mode 100644 tools/testing/selftests/sched_ext/core_forceidle.c base-commit: f4eb2ace3efdd8b6e3b0946bbd316166edb1a51e -- 2.56.1.839.g22a8290db9-goog