Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp827217ybl; Wed, 29 Jan 2020 10:19:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzS0HvmSXfHZxSLGKK3AuLubht6uV9Z46sFakNVRb9ib+9QrCA986EOzvUvlmQ3yHa3MF0o X-Received: by 2002:aca:7244:: with SMTP id p65mr160982oic.50.1580321967162; Wed, 29 Jan 2020 10:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580321967; cv=none; d=google.com; s=arc-20160816; b=PmNWqKoNhz+JIaDjMMvY3T81GkX7ZCY6zwUEMhMcozzDBsTfp7G079Xr8y75M/yJqp 5ULVF+8ETxrcwsf1rdsQauiApwVYxI3kPnQaStmPJJuqSYpwtYpXXgpOP8zUNd8D1geC BRPpfHQM2li26k9aQge/hzMKx17j67BA7j/8kgSO8j4EZXStxUUvT27JIV+xe4OI092H aCL7kKkYhOR7F3MjwEqcEVjLzgl7fcpgNfHVNk2p9qt8dHD3gF9jsIyFeecOA86bifbl llV0+OeKSit9B3LNRgtBkfhzsfH36IS4eb7Ja6LzPaN3t9wRSmETI8/RFG+gFKo4aMFC dSIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8WKIkUPd6TMX2CPP55W2WsWV9vmoDf73F58V3+ZZ+LY=; b=VLLMHvV081opoGSLdvQ7kwyg0Fhs96Dyf8vwUTGTpc69iuNEClE1RPNiPmxKJjht27 e3gIX62efrOU7f3hPTuBRUE5aiH94mlqGZQRCpj3cf7kNkmCy8PLbivZxHUdWWEpMxJF LsPwhY//wT3kdc2p5/rDEovai0c9H8Qv3qZmkv+282MOIGiwPg8hV+G/UE65XYAdJXiH TrALCqLmb5dX5by047zAwooS8yHHKdwVVuAAs0XyYKiXEBYQzxp8y1Rv4tFiXmReDBpJ d26NQ4QwuXuEMX6+C/HM6R4NXDzdI8DbYhJLHSI50f25n+dKzMsVpEu1s44UK4Se86Zq wz6g== 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 j9si1414552otq.317.2020.01.29.10.19.15; Wed, 29 Jan 2020 10:19:27 -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 S1727193AbgA2SSK (ORCPT + 99 others); Wed, 29 Jan 2020 13:18:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:43660 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbgA2SSK (ORCPT ); Wed, 29 Jan 2020 13:18:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 925F4B28E; Wed, 29 Jan 2020 18:18:08 +0000 (UTC) From: Davidlohr Bueso To: colyli@suse.de, kent.overstreet@gmail.com Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dave@stgolabs.net, Davidlohr Bueso Subject: [PATCH] bcache: optimize barrier usage for Rmw atomic bitops Date: Wed, 29 Jan 2020 10:08:02 -0800 Message-Id: <20200129180802.24626-1-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__after_atomic(). Signed-off-by: Davidlohr Bueso --- drivers/md/bcache/writeback.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 4a40f9eadeaf..284ff10f480f 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -183,7 +183,7 @@ static void update_writeback_rate(struct work_struct *work) */ set_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags); /* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */ - smp_mb(); + smp_mb__after_atomic(); /* * CACHE_SET_IO_DISABLE might be set via sysfs interface, @@ -193,7 +193,7 @@ static void update_writeback_rate(struct work_struct *work) test_bit(CACHE_SET_IO_DISABLE, &c->flags)) { clear_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags); /* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */ - smp_mb(); + smp_mb__after_atomic(); return; } @@ -229,7 +229,7 @@ static void update_writeback_rate(struct work_struct *work) */ clear_bit(BCACHE_DEV_RATE_DW_RUNNING, &dc->disk.flags); /* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */ - smp_mb(); + smp_mb__after_atomic(); } static unsigned int writeback_delay(struct cached_dev *dc, -- 2.16.4