From patchwork Sun Sep 24 10:39:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 144114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp718931vqu; Sun, 24 Sep 2023 08:31:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGU91vTykbanopXMsMR8TxrUMM788w/IJFI9ARLkxXqxZ+rEh+3JA/6oOnHBSRQcBEkoqU X-Received: by 2002:a05:6a20:430a:b0:140:6979:295d with SMTP id h10-20020a056a20430a00b001406979295dmr3510831pzk.2.1695569485320; Sun, 24 Sep 2023 08:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695569485; cv=none; d=google.com; s=arc-20160816; b=MloC0F8KNW5R+352eSZ44bPx+v7GPE9uFHYp6suJ++TZxFQaNhjQLAH+GfKi3zr5NF +z6PkDU5HIbcLwNL25kH6+yfBksQvSwkj37sZteo/EPBifDe+eni5vR7nGYt6VJEpOY1 f7IkzpbmUoqNtKCfd0Z09BBHdkX3gdo9e0xLpKDe0sXESYmGQ3j/suz6JIvKpT5oYd4V K8mSNqwcPKhKkGl2Fvax0H4HQJByAX7WuPNb3C+04G4iT8elGl9gOkFChcgI3SqgZyeV inkp1C/M1CMldgcI4E4Eozzo9C8wjoBBZ8xUr1magRQZ0F5Crkx8QG9j5SVXUa5FcjeZ VBhA== 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; 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v8-20020a17090ac90800b002764fc6134bsi9897170pjt.69.2023.09.24.08.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 08:31:25 -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; 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 9E6E2809F3B8; Sun, 24 Sep 2023 03:40:01 -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 S229965AbjIXKji (ORCPT + 30 others); Sun, 24 Sep 2023 06:39:38 -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 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:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777933468585694668 X-GMAIL-MSGID: 1777933468585694668 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