From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C62B5307AD5 for ; Tue, 24 Feb 2026 08:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771923193; cv=none; b=nhZTwI+E26nubaIYgCfmUKXcBhqYqXcR3CtJn0IT4i0fCUwSv0PKyFUbCE2x4jX2iUYlThbVOfZe2zp4loTOzBCdC8BBcLvHjoZX4u0DNdWeTpe4xYlMo//s3ceKbOaCw27hjd57Uv/CAC28BaHJ2RHft/QqopXDuOdT3M0TW3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771923193; c=relaxed/simple; bh=IOgoIi2ZlPP8QN8ofaNoLUqrb6mJ5i523Fiesran41c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rqLHHNYg+dMmsLB2REHl+APsQ8J3iNY9lH0GdpUXzSmE2i44k4XBLphbqixi2HWiv+pZxNfYwca/BKSnfm/Bhh9CQHbg+9uUCB2T3CpEthHu/iXlu+SHqZmJOVn1ovwmzNErfV9lLHjWkJ+TtyyEeQRDV3W8KKKHy+vcink4Igg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8FE76339; Tue, 24 Feb 2026 00:53:03 -0800 (PST) Received: from [192.168.178.6] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D8BEC3F62B; Tue, 24 Feb 2026 00:53:07 -0800 (PST) Message-ID: <41fce66a-3bf8-458e-872d-845713c19721@arm.com> Date: Tue, 24 Feb 2026 09:53:06 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/7] sched/fair: Fix zero_vruntime tracking To: Peter Zijlstra Cc: mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, wangtao554@huawei.com, quzicheng@huawei.com, kprateek.nayak@amd.com, dsmythies@telus.net, shubhang@os.amperecomputing.com References: <20260219075840.162631716@infradead.org> <20260219080624.438854780@infradead.org> <20260223141513.GQ1282955@noisy.programming.kicks-ass.net> From: Dietmar Eggemann Content-Language: en-GB In-Reply-To: <20260223141513.GQ1282955@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 23.02.26 15:15, Peter Zijlstra wrote: > On Mon, Feb 23, 2026 at 02:09:52PM +0100, Dietmar Eggemann wrote: >> On 19.02.26 08:58, Peter Zijlstra wrote: >>> It turns out that zero_vruntime tracking is broken when there is but a single >>> task running. Current update paths are through __{en,de}queue_entity(), and >>> when there is but a single task, pick_next_task() will always return that one >>> task, and put_prev_set_next_task() will end up in neither function. >> >> Tried hard but I don't get the last clause. > > When prev==next, then put_prev_set_next_task() bails out and we'll never > hit __enqueue_entity()/__dequeue_entity(). Ah, I see. But IMHO put_prev_set_next_task() is never called for the testcase below (CPU hog is prev and next in put_prev_set_next_task()) But (prev != p) in pick_next_task_fair() is avoided ? pick_next_task_fair() if (prev != p) { while (!is_same_group()) put_prev_entity() set_next_entity() put_prev_entity() set_next_entity() } [...] >>> Test case: >>> # taskset -c -p 1 $$ >>> # taskset -c 2 bash -c 'while :; do :; done&' >>> # cat /sys/kernel/debug/sched/debug | awk '/^cpu#/ {P=0} /^cpu#2,/ {P=1} {if (P) print $0}' | grep -e zero_vruntime -e "^>" >> ^ >> | >> Works >> only w/o this comma for me. > > Hmm, weird, for me: > > cat /sys/kernel/debug/sched/debug | grep ^cpu#2 > cpu#2, 2500.000 MHz > cpu#20, 2500.000 MHz > cpu#21, 2500.000 MHz > cpu#22, 2500.000 MHz > cpu#23, 2500.000 MHz > cpu#24, 2500.000 MHz > cpu#25, 2500.000 MHz > cpu#26, 2500.000 MHz > cpu#27, 2500.000 MHz > cpu#28, 2500.000 MHz > cpu#29, 2500.000 MHz > > And that ',' was added because otherwise it would match the full 20 > range of CPUs too, which was not intended ;-) Ah, the ', X Mhz' thing is X86 specific. awk '/^cpu#/ {P=0} /^cpu#2(,|$)/ {P=1} {if (P) print $0}' works on Arm64 as well.