From nobody Sat Dec 27 17:03:14 2025 Received: from wxsgout04.xfusion.com (wxsgout04.xfusion.com [36.139.87.180]) (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 7093A4B144 for ; Mon, 18 Dec 2023 12:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xfusion.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xfusion.com Received: from wuxshcsitd00600.xfusion.com (unknown [10.32.133.213]) by wxsgout04.xfusion.com (SkyGuard) with ESMTPS id 4StzSl6d5Pz9yJ0N; Mon, 18 Dec 2023 20:21:11 +0800 (CST) Received: from localhost (10.82.147.3) by wuxshcsitd00600.xfusion.com (10.32.133.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 18 Dec 2023 20:24:45 +0800 Date: Mon, 18 Dec 2023 20:24:44 +0800 From: Wang Jinchao To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , CC: , Subject: [PATCH] sched/core: Simplify if logic in sched_update_worker Message-ID: <202312182023+0800-wangjinchao@xfusion.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-ClientProxiedBy: wuxshcsitd00602.xfusion.com (10.32.132.250) To wuxshcsitd00600.xfusion.com (10.32.133.213) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reduce one if statement, remove two lines of code, and improve code clarity. Signed-off-by: Wang Jinchao --- kernel/sched/core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a708d225c28e..97c7d3097947 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6748,12 +6748,10 @@ static inline void sched_submit_work(struct task_st= ruct *tsk) =20 static void sched_update_worker(struct task_struct *tsk) { - if (tsk->flags & (PF_WQ_WORKER | PF_IO_WORKER)) { - if (tsk->flags & PF_WQ_WORKER) - wq_worker_running(tsk); - else - io_wq_worker_running(tsk); - } + if (tsk->flags & PF_WQ_WORKER) + wq_worker_running(tsk); + else if (tsk->flags & PF_IO_WORKER) + io_wq_worker_running(tsk); } =20 static __always_inline void __schedule_loop(unsigned int sched_mode) --=20 2.40.0