From patchwork Mon Dec 18 12:24:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jinchao X-Patchwork-Id: 180354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1205901dyi; Mon, 18 Dec 2023 04:34:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY+cQ0MYVsSwce+eKkg1BHH+h6dZyPOtukZJVWZjaT03fItlKEFvGJ/qgnJ1S8zwmt2Bgd X-Received: by 2002:a05:6a00:27a1:b0:6ce:2df5:48b with SMTP id bd33-20020a056a0027a100b006ce2df5048bmr8701040pfb.32.1702902858993; Mon, 18 Dec 2023 04:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702902858; cv=none; d=google.com; s=arc-20160816; b=TXI4E2XOMKHGB7noLbbzty0YUPW9HjlD6S61uHHqTuvF8XHUEenh7hirO8GuIX0Fh3 8vLxWGvjY9wP+mJTsvdCPJydU47Wo3hx1uqXydBBUtxoeXTqLEisMnfnfTR8QIApmbzi tuEsUKM8isaGdHlxwtRFD146TrbmCk+mU0pKOVanOs9SQ8raJoC/kWycfh+BIC/IOHcA hnp6SkE6p7mlTdwJTmmI6ewR4EniA+UZr18pfyEmU4h3lEP98vCHScCWPh+X9uUU43jn +F9qFHf6e8QSZb5lGUv53kWO1NP62KzgdrZKcSqpO7ROvrwRLLzdwKFwq0hMrrEXX7U8 xQgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date; bh=24EkZPaRN9UBaT8rdi23ezjh2Vzt4OvTt56chIdSht4=; fh=f40UFx4PIoN5VHjot5Te0Vsnl2epc2I3Vpkjl2f6MCo=; b=gXGkREZuYphC4cetNM3Qz0otdzSy2F6jvUu4RWbDc5DxZSrTcNzrwJICHgp4vHvstB jdEwxql0QMh0V+7KzIsTIE8/BCFrQ047umDWWZ0MeBCQ+zBoz61S+dwOKYQlVp2NVqek B3EbxwMq1H1qQo22CI9Zuj0raN/uWyMvgho0jCqGdyJ52f6wcVoF/hhQZB5cPDFr+bup k2+KjQ1YqUUYlkvXssD9xcOiWy5lt7BAdRH6bszPm3mGpWErGoISDmjyv8uPaSifPLEI slGiy8I3qvo+3dA6aeDtiDAiojnmqurn2EpXHp1pMc4du6Kv8JQYmEZAaB34/QVMItkJ gG+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3566-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3566-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t19-20020a056a0021d300b006c8d6276334si17127423pfj.140.2023.12.18.04.34.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 04:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3566-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3566-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3566-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4C2732855E8 for ; Mon, 18 Dec 2023 12:25:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCF774B5AB; Mon, 18 Dec 2023 12:24:59 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785623068237407555 X-GMAIL-MSGID: 1785623068237407555 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_struct *tsk) 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); } static __always_inline void __schedule_loop(unsigned int sched_mode)