From nobody Mon Jun 8 13:31:22 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.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 2193D358384 for ; Fri, 29 May 2026 02:35:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780022152; cv=none; b=DIzsho22CDoSJkEX4i7WcPQuuDzvolqlkmiel9WNfxpA9QTbXNNukw3U2OxTNmc7PkZYuoSIy3IJdjk0MRD5/uzMIn0Dnm4hlxxS68gXtfJ/EXeEd5VxC5Cw7yaNKPg76awJeGAqxSwCE9/cV+HujHho2AGW15z0vfntGHE/API= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780022152; c=relaxed/simple; bh=/KuN56w3KBM+AHjohSLVM3+sLVDwwoWfqZDHywjaK0c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N3d8uAn4C6ZraVD4579xF25vxsuBLiIOYaKDVVIloowY+5jv7X0yznx960ZVu29MbkwjCmVD5gP5HlhslN5JQLuRC9jn6ksol4uwZ6YbMKkM16TEbNW6GU5ukhp6mxTZnWk+XDqimADvW2CEG/zx7PW9Xhi/aG8qz/sFwVVnGic= 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=ebB1xUZJ; arc=none smtp.client-ip=220.197.31.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="ebB1xUZJ" 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=BA snm/8bCpnSqiNNA8zowXo65wPPzCk/hPS/IWEQ4Jg=; b=ebB1xUZJmJC9CxTadv x9QaCFwfwlcOZbm61bsKOLko4HNSd3zz1ewcZpxpgVYLhzCSbOdDNEqstuOVPSHp s2cUsR9T2AK6hqtPjQQXF1M+QMHZallixSvntz695HZDW8CmLf0yGAjuJnCD/rUR LQou+b7x1GD1ANAtD3RGYodeE= Received: from vbox.. (unknown []) by gzga-smtp-mtada-g1-2 (Coremail) with SMTP id _____wDnFgw7+xhqYKXHAA--.5121S2; Fri, 29 May 2026 10:34:38 +0800 (CST) From: Li kunyu To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com Cc: linux-kernel@vger.kernel.org, Li kunyu Subject: [PATCH] kernel/sched/fair: Fix to not require calculation for the weight nice0 Date: Fri, 29 May 2026 10:34:13 +0800 Message-ID: <20260529023413.482020-1-likunyu10@163.com> X-Mailer: git-send-email 2.47.3 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 X-CM-TRANSID: _____wDnFgw7+xhqYKXHAA--.5121S2 X-Coremail-Antispam: 1Uf129KBjvdXoWruFWrZrW5Gw4xCw15CrWUCFg_yoWfGrc_u3 ZY9F4fK3ZYkr1vqr17C3yfJryFqFWUtF1xu34DGFW8Jw4qqrZxJr93AF95JFnxWr1UAF9r urnFgF9xtws8KjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRNvtCUUUUUU== X-CM-SenderInfo: poln30d1xriqqrwthudrp/xtbC-x6uU2oY+z7HcQAA3d Content-Type: text/plain; charset="utf-8" Typically, the default priority for client tasks is nice0, and reducing the conversion of virtual runtime to real time for nice0 tasks can significantly reduce unnecessary computations. Signed-off-by: Li kunyu --- kernel/sched/fair.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 69361c63353a..74d1c77a8bcf 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7033,7 +7033,10 @@ static void hrtick_start_fair(struct rq *rq, struct = task_struct *p) resched_curr(rq); return; } - delta =3D (se->load.weight * vdelta) / NICE_0_LOAD; + if (unlikely(se->load.weight !=3D NICE_0_LOAD)) + delta =3D (se->load.weight * vdelta) / NICE_0_LOAD; + else + delta =3D vdelta; =20 /* * Correct for instantaneous load of other classes. --=20 2.47.3