From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 5CCBF1D5CC6 for ; Tue, 16 Jun 2026 03:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781579222; cv=none; b=rWCStRU7w3wxT6cMVa7onV2npAO0SlTi3gWm4qTPwRcjZrz8a4mVQDVEpWiN6jtJ6audJCDe/uCw6MXPXjfV20SI/+Y/gOu0YF4boegWbsSaSyy1ihlLGbKv1a3/Mna0S1jaJ1EDaWjimgO+l/7d/dbQyS6aUvlGZG40iHDebZ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781579222; c=relaxed/simple; bh=B4jVM5Rky+8QLpVBMeyb5DPBnrjnKkDa47ANtN4x4FQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Rcba6I6gqgDrFKssYC43Nko1jgPmq27Dkn/D9CIGJLsPD3g6eQ8B8DXM2W9qKreESrFcR+sgMNoLJXVTb0WkgZK+OWXWDp156sZckeN5ZXgrw4Hp5M3CKeKs8TI0mIs+zD2+PkBXB7qyz3Q0CNqAENYsbKXrJ/8m7OMd4TDuYvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=PYhB3rQJ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RMLnrWgX; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="PYhB3rQJ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RMLnrWgX" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65G1xhbp1690543 for ; Tue, 16 Jun 2026 03:07:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eo0DXWUIXh5wLpkLJhbVu9Qd/WW8+VGAjyXHuczg7J8=; b=PYhB3rQJIrgEGrBc 1ZttfAxGQrbqIkm5K62HhaAKMGzSvlQHmwhXbh1kXoHDxqqvfy1etztn8Os17qce as40VBSyCXwoUiseQmY6MKD0RKizNTzvCF6o4PwTByVx1sPXqcPhDUdCqAA4+pBQ NrLq8xvrRlpvr6TwOQvu/u53dU/ac51bw2L+sj4EYohGb0G4pTBFQ+uLIdDb0x9y bvp3X4UD5+kTdnvk2X5WaIY0NnPmDuSRqnYZgVd2LUa2GmFPav0DneXpxPUV3oJH avZgBTd6tKCtBVelCqaFAn8W42mTwV4yERU9ZMWYotuS7aqCu9iPYAG9g1b1nyMG 0JB21w== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4etetjvesh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 16 Jun 2026 03:07:00 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2c680ead9edso2839785ad.0 for ; Mon, 15 Jun 2026 20:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781579220; x=1782184020; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=eo0DXWUIXh5wLpkLJhbVu9Qd/WW8+VGAjyXHuczg7J8=; b=RMLnrWgXz1hTKTb5ZdVliw0OqeCbLzDCksLKtiMAacLCSrPRCuHKUKKyi4Cl5CbHMK ajpKWD6/jN8e3byoBKk7isAKKQBNNKiLnv+IUoNxjsl6NL8ZiPEpIHxOss095GRSTxq2 vTFeqCpmxHVr3adj2TdfWfHewGDxypwKY7iLzVJzbl0UyQypIbL3gi6sdseYSD8rnozE KnQZeWPJvoUhV5Niyw6pVCIqbDtnNwFx1WdOK1xZ2IWRkQX/Ubj2FfjvRIQSlwFnj/Xj Xw4GDVU5aJUOl+6T4Ly9kCxUGPUQTgPkL7m4B9enz9bXVL8AZhweByIF7ZbeMXntDpgz bDiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781579220; x=1782184020; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eo0DXWUIXh5wLpkLJhbVu9Qd/WW8+VGAjyXHuczg7J8=; b=Jix4a0vGXIMRmK7KW9jrXjgMS77DKq6Z4sO/catWDvSWvVOydMRL7w5tTOSeCcojUa upXwSsznWOCX6RU2rK7dAjVbLYWJzdIRC9vwTo9EcCDdm573WkOdV1+wiKydilk3hXKO ryjmdyB/aZv+t94S2IDTHdhpLHFX2xgKtEDHaUhT2yY+r0yOU+AZv95Z3KXIABFMwxZd JCc92vuVhjxHwo+wSw+oAthJ3tKYgfwhbIDRu/1139t5C7BupNsL1zijmo5CRdbKHysj TH2phsdt7bbqevW9XWRDJrsesiuDecGmbcXJmmt6YY7Gga1K106jfz3Vu3UzC3EEXg2q BEQw== X-Forwarded-Encrypted: i=1; AFNElJ8masRVLm+47ZgImimQKdFRGD1EueJRxpk8aKvi9EQHnCmJ4hNYyOjSbIE3/QbXMLEDEUDbfeFu5zZ9SSs=@vger.kernel.org X-Gm-Message-State: AOJu0YxC8goxE+8b+EB2rEUG4r5o3ZnjgTluaJNcv/VCf4qmOr/ko9zz iToBaxnKTJQuaxFZub2ZPJU7YC/3OHMsfDMJiAiJ7wdhmIWtlDpwnq+u70UllK23uLaLB86yX5z mnyPGXZt6zjOK4d0cJvfsMIq6gGsAw3e0d8c8y6eRlcP92LQh9nMURri92Yz0/EKkE3E= X-Gm-Gg: Acq92OGWAL+2augacghPtiJr0mWFdd3Fa1u0iQ28BqHNh+3JeGo5ShAILsopgY0QRFK hrAW/7ZpO4td/uMjNsuR2XKxpzOzdUhip6TIhFI3QFnHyb+6N1NSzVU3i6UUCync1OcTlfWza5+ vKMmA9AxSNmnEy1oW0d4FV5T6ZBt38QQ9byXekOvEmu8qJeACt7kwhHdTOGtyk9COWzENV1Z3w+ JBAKiVFMjNe/m2l4CO0TldpdrZ+PI4IYsJNZi2Kw8PjLatbqeLAfCFSJrLwwkSGmAk6woHb9uiF h8fOdBdgN1darRvkk/wjO7zxRmc+cXMK2soVDzLBkRlhpcleE0upLm/EMWlfeMs2xoeYzn9zFep q/97GcYvuQ8yl8E9upBMBhI6J/bfsMeYilvlJ3+xgk+KjcICP00mdCIAgzx5sYLUbcwQeiODJzH PIXPAfh2Nf2m8= X-Received: by 2002:a17:90a:e183:b0:369:a719:6747 with SMTP id 98e67ed59e1d1-37a03acf7b1mr8136812a91.3.1781579219872; Mon, 15 Jun 2026 20:06:59 -0700 (PDT) X-Received: by 2002:a17:90a:e183:b0:369:a719:6747 with SMTP id 98e67ed59e1d1-37a03acf7b1mr8136790a91.3.1781579219328; Mon, 15 Jun 2026 20:06:59 -0700 (PDT) Received: from [10.133.33.43] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-37c522a3d53sm1035226a91.15.2026.06.15.20.06.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jun 2026 20:06:59 -0700 (PDT) Message-ID: Date: Tue, 16 Jun 2026 11:06:54 +0800 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 v3 1/2] sched/fair: Don't trigger active lb if src_rq->curr is CFS and not on_rq To: Xin Zhao , vschneid@redhat.com Cc: bsegall@google.com, dietmar.eggemann@arm.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 References: <20260615140900.3913018-1-jackzxcui1989@163.com> From: "Aiqun(Maria) Yu" Content-Language: en-US In-Reply-To: <20260615140900.3913018-1-jackzxcui1989@163.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE2MDAyNyBTYWx0ZWRfX5uymUt0VfF72 wM/q2wiYrpsLJsgqqW+1F6NgtVZz8WOvzCqrapf4yL25rqbEPWaD8KT03Re8KDcJFv+RS2ED9fP 1ih5T+xlFCIiujngaBy7CUSWzD8V588HDr1zp4ZqiuZ1OZFaxguED6LkICl6Eq1yn4DE/Sz6ZLk BZE8QatEyhL5PuUHg6mkXw2KCxTqNUinva42tGCsZDfhmgEcyOVcE1keQpq4ju6B/Tnz1Vey8dj OVubMwawbrVgrRL0Up8WHOVnRxQCsG7NyIqn6FLhi13Upkgy739uiM93e+lxpVh5Zw4WIgwh7fa xC4FyeWNn9dDGnIUljQeC9FqT/AVsvJ7XquF2KL9+PpIvHZn6sbX82T2IjVoBfH2YtHXCnTuNFE sT4cqC2kkV+wSjeq6vyJi4OBsFPIIvVi1kTVTfn1wqC2AYT6kesNOJczsa1fHLUEX+SzIKvSq5W if2nMNdmeQkRJxEGszw== X-Proofpoint-ORIG-GUID: FdhXEYnsAN05oYyXDyJ0Oh6B3uFuvnIW X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE2MDAyNyBTYWx0ZWRfXwWq+Oc28RJDG IEyzWSea54+9aqvaL/uc/SFXoGN4s6Y2NxUsT+F6/3DUAJ0HaVfXuYDNWQcuS8QMdB0772X6dWv gAwzsTmqdeCiq1GmN7g43DEefXBPRZU= X-Authority-Analysis: v=2.4 cv=HttG3UTS c=1 sm=1 tr=0 ts=6a30bdd4 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=20KFwNOVAAAA:8 a=SkW1tD85Tf8PTmK3issA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: FdhXEYnsAN05oYyXDyJ0Oh6B3uFuvnIW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-16_01,2026-06-15_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606160027 On 6/15/2026 10:09 PM, Xin Zhao wrote: > On Mon, 15 Jun 2026 15:39:22 +0200 Valentin Schneider wrote: > >>> @@ -13436,7 +13436,9 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq, >>> * ->active_balance_work. Once set, it's cleared >>> * only after active load balance is finished. >>> */ >>> - if (!busiest->active_balance) { >>> + if (!busiest->active_balance && >>> + !(busiest->curr->sched_class == &fair_sched_class && >>> + !busiest->curr->on_rq)) { >> >> This should be commented; I restructured this a little, it's one more label >> but it reads better to me, what do you think? > > :) Thank you for your changes; it looks much better now, and the necessary > comments have been added. This format looks better. > >> --- >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index d78467ec6ee13..a0ac31a3be988 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -13482,12 +13482,22 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq, >> * ->active_balance_work. Once set, it's cleared >> * only after active load balance is finished. >> */ >> - if (!busiest->active_balance) { >> - busiest->active_balance = 1; >> - busiest->push_cpu = this_cpu; >> - active_balance = 1; >> - } >> + if (busiest->active_balance) >> + goto no_active_balance; >> >> + /* >> + * @busiest dropped its rq_lock in the middle of >> + * scheduling out its ->curr task (->on_rq := 0), no >> + * 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))); if busiest->curr->on_rq==2 (TASK_ON_RQ_MIGRATING), it is no need to do active_balance as well. >> + goto no_active_balance; >> + >> + busiest->active_balance = 1; >> + busiest->push_cpu = this_cpu; >> + active_balance = 1; >> +no_active_balance: >> preempt_disable(); >> raw_spin_rq_unlock_irqrestore(busiest, flags); >> if (active_balance) { > > Thanks > Xin Zhao > -- Thx and BRs, Aiqun(Maria) Yu