Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp739030rdh; Sun, 24 Sep 2023 09:30:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHByrhWQlDYzgUTKYp7jzUQIVqDo1ZizF2EVZbNsxzI9ohn9Zb2AYx4YT5cVbQtWZCbB5Xi X-Received: by 2002:a17:903:22c7:b0:1c4:5e9e:7865 with SMTP id y7-20020a17090322c700b001c45e9e7865mr3661333plg.0.1695573039716; Sun, 24 Sep 2023 09:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695573039; cv=none; d=google.com; s=arc-20160816; b=sgdgyUk5Y8B0TFNqMWiOpGYAqVmJe5QxF8mWXffhagKGWwdsw5UDRsB7QDsZVGgelq UqXzjlzOgqOiznnYS5HeZ59V+9/DC0p12YJQDnwqO4BTFUlWyEOsySQ2fLVBj1NovbmN 3F3tj7v78W98y5Bn6jsmXHOB98qWFiAmCXkVagFh1hhhHN5FJFvDXDgxdNl+A1ieqTNH t9AQNVy6Tu0err3So3EEGVzetzD8i7h0WuyQ35YcVeSQhyj7jk+M35Kda8PUbFqp+qJm WQDMcAzcrNfXm6yB4Z83NzAlCo8aHNeuEUOzxGgf7IAn6SOx3N6g0LDyjaaXpgmVQGKe kBgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=aVJiYUzD9F29394TtoNsTaYS7Ooze63GOZWkFzLlpMA=; fh=EJ3ldraINebT+shsWZdLHdSiuGLmW28h95aOW4drlxo=; b=HGOjusy28r3VT2zomBw6Wq5PNmv/gpyRTfDhGHhAvFmHjLXeTrYUW2Bl6m8yAF6+A7 WGomDtk903Q8T7ov6PMntNMmxB3/3QsQFCGH4q0pbp0kU7ZoYUrEkffJyNefB5g6CoAK ab9dDJWCLDb789GtxMT/e8RIisNNNsKUgprUutTRhWtzGWYfa/3koRMo5/WsR+KoPyrb wMQXn89WrVVqTTJrw+ady4C3BuMHobUFxwOxFvJPUct/7nWdmj7eylTCmkZCBXCDjjUP zVy+yTc1Ifq0ChHwzNIuggtHkQ8qw73ChJZ2rzxR6TmkiucntJsx6Sv4uEG3AopvO3aF ngAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=X3LnbuF2; dkim=neutral (no key) header.i=@linutronix.de header.b=Qz3PvNr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id kx16-20020a170902f95000b001c60cebfd6csi1887934plb.18.2023.09.24.09.30.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 09:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=X3LnbuF2; dkim=neutral (no key) header.i=@linutronix.de header.b=Qz3PvNr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D52AF80A2208; Sun, 24 Sep 2023 03:40:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbjIXKjh (ORCPT + 99 others); Sun, 24 Sep 2023 06:39:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjIXKjg (ORCPT ); Sun, 24 Sep 2023 06:39:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A95E100; Sun, 24 Sep 2023 03:39:30 -0700 (PDT) Date: Sun, 24 Sep 2023 10:39:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695551968; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVJiYUzD9F29394TtoNsTaYS7Ooze63GOZWkFzLlpMA=; b=X3LnbuF2RoinoquB8qVFCf5wyu/Pnz1ZoRRTdmMznmG4tYI9GiLLa7FdXT+IPRXtQu/Xky Ks43mX/4JMY8F0NJGqbXlklUFklQVUtqUn58KypTeyV/47kXOJZ9PLaJdhuHiNqamshkxv SMF6ZXooxSIuC+vJ0wYHvlPa3ED7ZHfZTPV0O56DGG+r6pgdh4M6EC86ns3n91Dl3Jn0Mf F3cOm8H7Qj4rNjhSQVhatCIQ/H/aE23s4Ou/z4Xr0Fk0vHiMixhOKGfmhw/xWhKNXWYj7K TOnE/SN3bPlvMCOtZZq1qOA0XqHWugNN+uE194s9j0lYQaTBfRi4RBj6Dr4VSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695551968; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aVJiYUzD9F29394TtoNsTaYS7Ooze63GOZWkFzLlpMA=; b=Qz3PvNr4tCoAb333h8NE8OICyLqhweMBjp8yQFJG5FcDo3BRDP0T3HQiWHTDCpfFpnLxOz nFGwbLzjn7LQrODg== From: "tip-bot2 for Wang Jinchao" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work() Cc: Wang Jinchao , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <169555196768.27769.8331878851124889212.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 24 Sep 2023 03:40:07 -0700 (PDT) The following commit has been merged into the sched/core branch of tip: Commit-ID: 3eafe225995c67f8c179011ec2d6e4c12b32a53d Gitweb: https://git.kernel.org/tip/3eafe225995c67f8c179011ec2d6e4c12b32a53d Author: Wang Jinchao AuthorDate: Sun, 20 Aug 2023 20:53:17 +08:00 Committer: Ingo Molnar CommitterDate: Sun, 24 Sep 2023 12:15:06 +02:00 sched/core: Refactor the task_flags check for worker sleeping in sched_submit_work() Simplify the conditional logic for checking worker flags by splitting the original compound `if` statement into separate `if` and `else if` clauses. This modification not only retains the previous functionality, but also reduces a single `if` check, improving code clarity and potentially enhancing performance. Signed-off-by: Wang Jinchao Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/ZOIMvURE99ZRAYEj@fedora --- 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 1074934..84881a5 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6711,12 +6711,10 @@ static inline void sched_submit_work(struct task_struct *tsk) * If a worker goes to sleep, notify and ask workqueue whether it * wants to wake up a task to maintain concurrency. */ - if (task_flags & (PF_WQ_WORKER | PF_IO_WORKER)) { - if (task_flags & PF_WQ_WORKER) - wq_worker_sleeping(tsk); - else - io_wq_worker_sleeping(tsk); - } + if (task_flags & PF_WQ_WORKER) + wq_worker_sleeping(tsk); + else if (task_flags & PF_IO_WORKER) + io_wq_worker_sleeping(tsk); /* * spinlock and rwlock must not flush block requests. This will