From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EE213A5430 for ; Tue, 16 Jun 2026 04:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781582942; cv=none; b=Jsvpak2q0MYlGuHqT9+KSfc20pEgP762t1JZDTFaoCtXTHJIv2xkwUddKHG9R1iu1eYe4h124ltDG25yS0lEByvCEVO4iZBOr9/Fw/uYj4nTqEHqrnwqCRaAU0RG0g2uZnNq3ZT5g0vC/KBa/nsDvkRkttotg6TNYsGBPuUGqHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781582942; c=relaxed/simple; bh=84tZdYbXn+Zacyr+Sy1QtGMsFtR4EU1RwjnTM1XaABY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RB2D93DXNUKN5z8EQhKR5aDAtWjK5SrCnd+oSKbJOQ2tIxYFGeQIHrv+hzQRxYrLsZovvq9UI26Q7v7YecQe2JrYWLlKKmw7za+GaNY/X8ipv2FRehZu1snLmtZY2Jc96AGtDdC2247QGCHKlD+bqISNfXx4mbtXd0+gFSEZmhQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=TxyLa3rs; arc=none smtp.client-ip=117.135.210.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="TxyLa3rs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=p6 FiOmeiTVx4GwCCxOvphf6dfhpOs6Ccinox/bDJvyE=; b=TxyLa3rsKHJD2Yx4FX veEJzWtVwXhUQSaH/NXmtZ66VE6TF5tMDyIJwY2HCxG0lDMcQQ0lAxdtj3dlrnUz Xx9/zHmhmEiGVWyHKLTJEHtKPt/KHbfdxT9Cz1sEe1uK2aEtDA/cujUuK0YCQPqd Je5Dr4dRSdeZOxyOWoFoqWFhI= Received: from zhaoxin-MS-7E12.. (unknown []) by gzga-smtp-mtada-g1-0 (Coremail) with SMTP id _____wD3H8ruyzBqwIKWDg--.33542S2; Tue, 16 Jun 2026 12:07:11 +0800 (CST) From: Xin Zhao To: aiqun.yu@oss.qualcomm.com Cc: bsegall@google.com, dietmar.eggemann@arm.com, jackzxcui1989@163.com, juri.lelli@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, vincent.guittot@linaro.org, vschneid@redhat.com Subject: Re: [PATCH v3 1/2] sched/fair: Don't trigger active lb if src_rq->curr is CFS and not on_rq Date: Tue, 16 Jun 2026 12:07:10 +0800 Message-Id: <20260616040710.223458-1-jackzxcui1989@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3H8ruyzBqwIKWDg--.33542S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uw13JFWkGr1xArW7WFyDJrb_yoW8Zw1kpr W0ka1j9F1ktw4rAwn2v393WF1IqaykJayjgrnYqryayF1Yv3Wvqr48KrW5WF4xArn5A3Wj yrWq934kCF42vaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRTKZAUUUUU= X-CM-SenderInfo: pmdfy650fxxiqzyzqiywtou0bp/xtbCwA-U3mowy+8bugAA3a On Tue, 16 Jun 2026 11:06:54 +0800 "Aiqun(Maria) Yu" wrote: > >> + * need to forcefully punt it away with active balance. > >> + */ > >> + if ((busiest->curr->sched_class == &fair_sched_class) && > >> + !busiest->curr->on_rq) > > Still have the doubt why need to do active load balance when the current > is not CFS. And busiest->curr->on_rq==0 case only. > > Is it should be like: > if ((busiest->curr->sched_class == &fair_sched_class) || > unlikely(!task_on_rq_queued(busiest->curr))); The platform I am using is quite close to actual usage, and the tasks bound to different CPUs and different scheduling domains vary significantly. From my data, there isn't a single CPU with an active balance success rate below 50% under such scenarios. As for your earlier comment that "just do detach_task and attach_task and the success rate will be 100%", I believe you should take a closer look at the implementation of active_load_balance_cpu_stop. That should make it clear where the statistical code I previously sent you is located, instead of simply questioning my approach of performing an ineffective "detach_task and attach_task" operation to artificially inflate the success rate during testing. Regarding why the success rate of active balance is so high in this case, I have my own reasonable explanations, and I prefer not to repeat them over and over. > if busiest->curr->on_rq==2 (TASK_ON_RQ_MIGRATING), it is no need to do > active_balance as well. There is a slight difference for the compiler between comparing == 1 and comparing != 0. From my current understanding, comparing to a non-zero value is generally faster than comparing to a specific number in most of arch. I have previously tested whether on_rq would ever be equal to 2 and, over a long period of time, I did not encounter a single instance where on_rq was 2. This at least indicates that the probability is extremely low, and it may even be theoretically impossible for such a situation to occur. Thanks Xin Zhao