From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 C0B674B04B3 for ; Fri, 7 Aug 2026 02:45:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786070752; cv=none; b=BCg6QcHoNG3lRb+Kp8U0GMfG3akziUHZHoXyrziYvdV7L9SMeTywWfLVDFCLh96lM7Wupwea7pf40nOC/RcZwmE+dIPPrIOwy3VWnS7tbQBt2ASjQ6oG+kzdajThL9jg4GnEBJlX2qQJkUXLTusd64qXov/3Up5yGhncWowu18U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786070752; c=relaxed/simple; bh=7QCVRZx4Vbrh1AS++IRNJJnd496h0BjU1mHmdrF7CE8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LaGtefvo1dygMFOQEN/PARA4Woz+Zpm+amr7RuUMl4od3SfpKUUkY+hIg8j7jb8iMnD6qqnCM0ecsXYyzlhesgejQeEp9YoxBEPQirBWYv7DDBdWdjeCKyz2Aw7xci+7fuK09/lSK1qwH/0mhx1W+nSpYOELrlzSmCP6bFvnIgA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kyYxFrxZ; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kyYxFrxZ" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-384930ca5e2so3122840a91.3 for ; Thu, 06 Aug 2026 19:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786070750; x=1786675550; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=R2sBqIKzswtM2oUSZXlJzSYVKSblhFmTaopPNNS/h4s=; b=kyYxFrxZrSZONsv6aEYNUT1oKPNvdXZ4IUvbrsaxQN36cVS0u8rN11TTeJrg6IVNI+ ih6PZtxHvkn2r5P8sd4pJWgHXfOvufSYp83PT0c/3+LSz1CBzkJEYcF2yuiRKIPESsOJ QGjlwaPwvaca0Z5L7qxNiFxWtNuYCty5sr36d77kBLbEMRy4UoFCINFU5+zFkChvKfaZ 0o8F3VWth44tanwZjvFISAbB8zmOq2e4SLo2l3mgzA/kiziwMzQlmwx6ny3uuQHjBXlu 2AjU20BYypUt5TPbjJ9n/4q5GnrnCJfGjlDKOoWB+cftI6Qsl1sBBhyhvrEbkprOm3Jg +xrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786070750; x=1786675550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=R2sBqIKzswtM2oUSZXlJzSYVKSblhFmTaopPNNS/h4s=; b=solUzDP/+bTbltJJgmYf2qBWgjfWp6SqDSci4D5PYxNZ1VBICyHTE/Q1pUfW95VMGy XtpRWnVDrSFK3noseXsXi480eci8KnYV51WG+L1+VthzXcokrhziuH2ugH/OtM7OReMI wjRxp4eE8pdsuvs45GAoRCv/2A4GpaN0T9HaD1fmPMQisMIFwTCb4P2e9bW0KsW7iwAG Fahn9tZQdWHqkOo/4PUoU8qkft4ijRyCo4HEkhGVU6DVy3BQ0HZ+TUu0R7VerUNFe2xw ZrYjK2LP+yooeRnMfGJQj+x82Tmwekyg0ErTdfK8WxJQ4NqERurWLb5QWoviKU17XGO/ SBbA== X-Forwarded-Encrypted: i=1; AHgh+RqaaAxKzuw5uuh5KEF5bKk/hza+KXOnSr2bXHF5VMBzlYJ0/B9MKcC+wYYik2KmxY9xoY7kAV/QnAK6aWo=@vger.kernel.org X-Gm-Message-State: AOJu0YxLpPl+kXRhrStBNPU4zBFtUVEkOYZ9Igpeqg+2O2ePdIVWtRVS +mSpXpkat3lFLxH26rp5XB6s6uyewpeUXZ7IlEQ4zmpPGyUOqFYnrauW X-Gm-Gg: AR+sD11k465ABs5jzCdoktcjeZvNFMWmdeSJ8ploukNpTPf64tNG2rRuVgXp+d1khM0 Z6ZyEpevyGi/S3VReIo6MmnRy6OprnKGEalDtvT7c8BDPrUCzgzlOkUX0dEBxdFkcEXYxTtwWrV 9OYD1rUPfSSCu1++G7AVrKBNdm4JkdbNw28HDQ9/Gyl/MO7NrifnRLy0B+03FQ8WQPQUMg/dsTD 3wSaWiAZ/G9Eeftg4q4AOQNWxlS8x/g9QfOOa6wRi0FGn5+5mnXL0kuA809XdBJkuEP1x9cqApn jKBCzNxNFu0+wKMW7iG9y97WPpdA/UfycuuuCOs3gddKPmy9OMxhpPbJ7wTf8A6kfHWRsE2GrHM l9OlHx10QMDvyf9uDJkYUDexgtSglz84qE0YwUqUJMMGh6fbXyfLCqsm7r9auD4X5AHhcLQRn5H Lg1YXAoNMm2LcUDLWyXB2GjOXf4q87SEg2j7F6TTfNxZvmIyYEbqVH/hATDNhB7BJ7xccmaU8l X-Received: by 2002:a17:90b:2892:b0:36a:5d1f:7b6 with SMTP id 98e67ed59e1d1-3903c534978mr20904045a91.2.1786070750002; Thu, 06 Aug 2026 19:45:50 -0700 (PDT) Received: from osman.mioffice.cn ([43.224.245.178]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3925ff69eabsm390163a91.15.2026.08.06.19.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 19:45:49 -0700 (PDT) From: Zhan Xusheng X-Google-Original-From: Zhan Xusheng To: "Shubhang Kaushik (Ampere)" Cc: Zhan Xusheng , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , John Stultz , Christopher Lameter , Shubhang Kaushik , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sched/core: Skip rq->avg_idle update without a valid idle_stamp Date: Fri, 7 Aug 2026 10:45:40 +0800 Message-ID: <20260807024541.1136441-1-zhanxusheng@xiaomi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260806-master-v2-1-e1f3a1a0c903@gentwo.org> References: <20260806-master-v2-1-e1f3a1a0c903@gentwo.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, 06 Aug 2026 17:26:27 -0700, Shubhang Kaushik (Ampere) wrote:=0D > This can happen when the scheduler switches to the idle task through a=0D > path that did not set rq->idle_stamp via newidle_balance(), for example=0D > during find_proxy_task() or force-idling.=0D =0D There is a path that needs no config option, and I suspect it is what=0D your hackbench tracing actually hit: sched_balance_newidle() returns=0D before it stamps.=0D =0D if (this_rq->ttwu_pending)=0D return 0;=0D ...=0D this_rq->idle_stamp =3D rq_clock(this_rq);=0D =0D The early return sits above the assignment, and its own comment says the=0D task will be enqueued when switching to idle. So the rq goes idle with=0D idle_stamp =3D=3D 0 and leaves idle again as soon as the pending wakeup is= =0D processed, which is exactly when put_prev_task_idle() consumes the=0D stamp. A wakeup-heavy load like hackbench should hit that constantly,=0D whereas find_proxy_task() and force-idling need proxy exec or=0D CONFIG_SCHED_CORE. (Force-idle is the sched_core_enabled(rq) return at=0D the idle: label in pick_next_task_fair(), which is also above the=0D newidle call.)=0D =0D Worth naming ttwu_pending in the changelog? It makes the bug=0D config-independent, which seems relevant given the Fixes: tag.=0D =0D The fix itself looks equivalent to what 4b603f1551a7 removed: the old=0D ttwu_do_activate() code was wrapped in if (rq->idle_stamp), and skipping=0D the trailing rq->idle_stamp =3D 0 is a no-op when the stamp is already=0D zero. update_rq_avg_idle() has just the one caller, so nothing else=0D changes.=0D =0D Nit: unlikely(!idle_stamp) may be the wrong way round if ttwu_pending is=0D the common trigger.=0D =0D Thanks,=0D Zhan Xusheng=0D