Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5969331ybx; Mon, 11 Nov 2019 01:34:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxv7kwUlGcnDe7tg93umBlhz4k/hwCi73Az2CP5emrYsMR2YtPLqkGXjFDEcS9pbZy/9xue X-Received: by 2002:a50:fd95:: with SMTP id o21mr25870357edt.283.1573464845223; Mon, 11 Nov 2019 01:34:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573464845; cv=none; d=google.com; s=arc-20160816; b=bCD+6wxVZKa/gkHmk2T9StZaECx5EvrgQmXwpKyDYgcymgo7ut5cKpmwCOxSPNdijw g3tZm8EYfaI0BgAhXZGLSW2nTezvKIiBWFY/vuWNXmYYlCVmTsJNZMRYk+HKRHpVfJwv jv5shQ8wir17ZV9nbpF8jv/hgPzq9Zuv+967zXy3BesJreamj6FjtfcRrLnTUFYaVmUZ KznS6XzHsOuDfkSl0FaZflasMQTTi3vJCSd18OIsQ5KMnGhqbgL5iHCS1TT+ea1TOY93 jeYbKMsZU+akLNgof3f7kQpccSrrKHiwG6iCm9XV1qEQ9Mz4N4U6/9A4LaNkwUlCZI8Q qshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=G3+Xr6BJSNsEa/wknvSh5Pbof5M0APwDW2n//6YudOo=; b=t56s28KCjwWmxcwgGrvPbFCFdaOYy33xjVZ6lUPOmUx7u3a/nKV6fq6rzhnBq9XKlY sHf/8W2HtfK19Fq8CuX1iitAsarUUo+gmQOxTNvuTy3jotwTk4FS6NhKHfRsj+ygfNDS s3r6m4HQPAUIv3OdrlBIxBUp+L4XjOaalOYg3scReqca1lMgimM5eaDpjDYQdZfNCz8l zAMQxG2Ies6V/F8rfJF7yTXg/rhPrtyiq4V42FKLkhX7dxbWpCNbJ4bUn8Ry179+okFJ D5OS8J/9C8nBdeuMaNmb6AJZ1O1XyI7Jnut/yPF1dt70orm/V++v67Qk7uFvFod1asfP 8xpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si9515316ejr.371.2019.11.11.01.33.42; Mon, 11 Nov 2019 01:34:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbfKKJck (ORCPT + 99 others); Mon, 11 Nov 2019 04:32:40 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:55742 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726768AbfKKJck (ORCPT ); Mon, 11 Nov 2019 04:32:40 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iU63l-000378-4X; Mon, 11 Nov 2019 10:32:33 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 9034E1C0093; Mon, 11 Nov 2019 10:32:32 +0100 (CET) Date: Mon, 11 Nov 2019 09:32:32 -0000 From: "tip-bot2 for Frederic Weisbecker" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] irq_work: Slightly simplify IRQ_WORK_PENDING clearing Cc: Frederic Weisbecker , Linus Torvalds , "Paul E . McKenney" , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20191108160858.31665-4-frederic@kernel.org> References: <20191108160858.31665-4-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <157346475217.29376.12478664809830197769.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/core branch of tip: Commit-ID: feb4a51323babe13315c3b783ea7f1cf25368918 Gitweb: https://git.kernel.org/tip/feb4a51323babe13315c3b783ea7f1cf25368918 Author: Frederic Weisbecker AuthorDate: Fri, 08 Nov 2019 17:08:57 +01:00 Committer: Ingo Molnar CommitterDate: Mon, 11 Nov 2019 09:03:31 +01:00 irq_work: Slightly simplify IRQ_WORK_PENDING clearing Instead of fetching the value of flags and perform an xchg() to clear a bit, just use atomic_fetch_andnot() that is more suitable to do that job in one operation while keeping the full ordering. Signed-off-by: Frederic Weisbecker Cc: Linus Torvalds Cc: Paul E . McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20191108160858.31665-4-frederic@kernel.org Signed-off-by: Ingo Molnar --- kernel/irq_work.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/irq_work.c b/kernel/irq_work.c index 255454a..49c53f8 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c @@ -34,7 +34,7 @@ static bool irq_work_claim(struct irq_work *work) oflags = atomic_fetch_or(IRQ_WORK_CLAIMED, &work->flags); /* * If the work is already pending, no need to raise the IPI. - * The pairing atomic_xchg() in irq_work_run() makes sure + * The pairing atomic_fetch_andnot() in irq_work_run() makes sure * everything we did before is visible. */ if (oflags & IRQ_WORK_PENDING) @@ -135,7 +135,6 @@ static void irq_work_run_list(struct llist_head *list) { struct irq_work *work, *tmp; struct llist_node *llnode; - int flags; BUG_ON(!irqs_disabled()); @@ -144,6 +143,7 @@ static void irq_work_run_list(struct llist_head *list) llnode = llist_del_all(list); llist_for_each_entry_safe(work, tmp, llnode, llnode) { + int flags; /* * Clear the PENDING bit, after this point the @work * can be re-used. @@ -151,8 +151,7 @@ static void irq_work_run_list(struct llist_head *list) * to claim that work don't rely on us to handle their data * while we are in the middle of the func. */ - flags = atomic_read(&work->flags) & ~IRQ_WORK_PENDING; - atomic_xchg(&work->flags, flags); + flags = atomic_fetch_andnot(IRQ_WORK_PENDING, &work->flags); work->func(work); /*