From patchwork Fri Sep 15 15:22:10 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: 140593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1225038vqi; Fri, 15 Sep 2023 10:59:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9xSWqHG6PW2CIiTRB9g4v2Nx2TpAxbi2nvsqteyN4o0mhjlCK1xOhdxcE+YnJh4L83Bpm X-Received: by 2002:a17:90a:f401:b0:268:4485:c868 with SMTP id ch1-20020a17090af40100b002684485c868mr1977570pjb.49.1694800773368; Fri, 15 Sep 2023 10:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694800773; cv=none; d=google.com; s=arc-20160816; b=UKPVE6sDnNG0TrhZGQZErYoZeK8KPeaMe3jseIl9pnl9se+y5KAOkCptbbLYb+V+2F +wf1Tk7jXOsiDsSRqbztShp9iLeeax+gRjtVB4w2DggI3nSjRJRvNXkbFDzz1gZ1Zgn6 Sm7ZK5EGvDuYhyD2f7qXWVT4OUyx21L9TXo7ydgC3UrKd7o47IJ9g/rGFE3u16r8TbFa IUTmZrKaHT7micchooFc81V9YXN29zZfrFGt5enI9r4sfXtO2aQKUz8+0r/Hy3VxXkqf QlP0gUhBnVuFlNpkfdJBFzB4BkeVfMZUxK2nTOsejZGXTibqyAWS1K6UzobeauAud1Cm bmLA== 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=zXvk3r4eLfALSMQsQXt7D31XO209Sjvfg9W6OVxL00Y=; fh=lC3L+tLu9jMrTwLXdci/D+zTDmYl6oRylGrfIkeVy60=; b=l4sVkwCkhM2L6wUTuspL/wiROC2SaAkOBUv0NxnlRDwCMl5w1OxLO+1g0y468W/+pa RYiEGAMtw1QTTuq2D62f6zxzhv33zo56PrspGOg/kqntkFvFvsjc4RWk5sevv8DqFgnS H6TZXCUi4taPk3fXvQ/bsvhTxHpGa7D+lJgG3hL5jBjacbNPYEfV72meLL10O/tj5sdf SokntFANI+ASPifHHBrkhyKIBdL7gkFGGNkgdgWomksXpDBl2qMByZPKLzDkfhwjX+7K /4JB+0K42Kw6W/wJE2/Oo0Ijhl0lvW6itiH41kL/+SGgqp/ej0gj/nSzIFQLSYneLPXt eGZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TKOctj+w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x1-20020a17090a8a8100b002748b96d88csi2183859pjn.179.2023.09.15.10.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:59:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TKOctj+w; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 9E8E2802A364; Fri, 15 Sep 2023 08:22:42 -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 S236057AbjIOPWT (ORCPT + 31 others); Fri, 15 Sep 2023 11:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbjIOPWS (ORCPT ); Fri, 15 Sep 2023 11:22:18 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3764CE50; Fri, 15 Sep 2023 08:22:13 -0700 (PDT) Date: Fri, 15 Sep 2023 15:22:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694791331; 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=zXvk3r4eLfALSMQsQXt7D31XO209Sjvfg9W6OVxL00Y=; b=TKOctj+wZW5aTodcgygciapIBZh6z8M9ECyEP/toI6je8uMfhZPXDEdvBmZ7u5MaCBOZNL 8kANfr+t5If1wl7e/HZZENrYRSBA9+4tivIzs8FvzvAPL0Ejt9hvbiK8H0f3dtYBqkhykL KLYO1T5jTWrWQZeMfG2bESIqnU9hWZ82RxOkSMTkGZXwfjqPajntGwFsWegoINE2gKelin XLbEg5Y+sGmeQcrxw9NDb4cu4L9E2kXv4fHpRcfcB7Aj3FQFP8qTnn495s4U1q8EFE26oS 3yu6oK4BThawd6oIcY1LxIJoXmDt1Q0uvbXwPaUiaDpCazGbRGQk+IdbwN0q2A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694791331; 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=zXvk3r4eLfALSMQsQXt7D31XO209Sjvfg9W6OVxL00Y=; b=MvbgZo/17ICWpSQAxkv/ZBbScLpfwRbgpQtoA/uQCvzt9y8ShPEZtF0pblM0so5uU54UYk Ue/gkCHA9vWjDPDA== From: "tip-bot2 for Uros Bizjak" 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: Use do-while instead of for loop in set_nr_if_polling() Cc: Uros Bizjak , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230228161426.4508-1-ubizjak@gmail.com> References: <20230228161426.4508-1-ubizjak@gmail.com> MIME-Version: 1.0 Message-ID: <169479133040.27769.13340324338034270661.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]); Fri, 15 Sep 2023 08:22:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777127415593758351 X-GMAIL-MSGID: 1777127415593758351 The following commit has been merged into the sched/core branch of tip: Commit-ID: 4ff34ad3d39377d9f6953f3606ccf611ce636767 Gitweb: https://git.kernel.org/tip/4ff34ad3d39377d9f6953f3606ccf611ce636767 Author: Uros Bizjak AuthorDate: Tue, 28 Feb 2023 17:14:26 +01:00 Committer: Ingo Molnar CommitterDate: Fri, 15 Sep 2023 17:18:02 +02:00 sched/core: Use do-while instead of for loop in set_nr_if_polling() Use equivalent do-while loop instead of infinite for loop. There are no asm code changes. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20230228161426.4508-1-ubizjak@gmail.com --- kernel/sched/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 76662d8..f39482d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -919,14 +919,13 @@ static bool set_nr_if_polling(struct task_struct *p) struct thread_info *ti = task_thread_info(p); typeof(ti->flags) val = READ_ONCE(ti->flags); - for (;;) { + do { if (!(val & _TIF_POLLING_NRFLAG)) return false; if (val & _TIF_NEED_RESCHED) return true; - if (try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED)) - break; - } + } while (!try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED)); + return true; }