Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp908122ybl; Wed, 29 Jan 2020 11:46:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwP4mK/9CcpyhY4lw0JLrfpkIcdf8KX8Irh5maFjhv5rjBOE/mPUM7/R/AfKKSsThd4xQNJ X-Received: by 2002:a9d:3e43:: with SMTP id h3mr716926otg.84.1580327165771; Wed, 29 Jan 2020 11:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580327165; cv=none; d=google.com; s=arc-20160816; b=C5tw6jHQbziXhrISVGX4t7x3As/VYN11BsGklWk2vS9+Ge6goyWOgT0AibtEol/+H8 n5hBm+JlwJ2tvTajff2RTNFaGhU9GtbdtNr3PUDujO1RuTBXm0AwLsAxJiFkvtjsJAfY qb4k0Ll2roAhZaOexon2ChyNVw73B5TjOjJ/3xRoaEIYrkxAZ+oE8G3xlAvmcUohgd9f f9xZsWyA+u2FGO+T1fvYySPhUDCXKaaPOIrVWGXEmaCUPGB1TqS6vXLkEu8liHBQk4/T In2mTVIOeLnkIrbhu9sDKNPF9KJZtFN3hW0ceN0bA+C5GM7UIyWcTTxomDyvEAsywWPg ye4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date; bh=KL2fajvCpOzBW8CEWfF9x8sDUqXPowPN81PAz/BgjbI=; b=yUTdMl1fRLfhE/sUoLl7CgX9eGIho3K0by/bN4n6XSIv5Udrc2eTCPEtfBHjxVVHlg fsHuaf9M08hIT224Io1CA/oYrwA1bPd+D5tTqLBiv495Ef8EvBcCw3OGujRII1tQRU1/ HHQZOCOMOG+ikTGycnHK1upKbd1/6cmPVvXAoqBvuKZRIAX84HfSfhFAnlY2xGUL2nyQ BF1b0sSt+CDKxi8ZHrGwX/WvEr5MFD6PLqtK4kckmgPXsziMdLm/d3SC1G9Z99bVlu3H emLixkK4H5FBFM3MyKwL17VzHo46NEyCOajp2dCJ/OYkbKeeNCbXBVWjbNi1JWKhZjB6 g5MQ== 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 f189si1540520oib.268.2020.01.29.11.45.52; Wed, 29 Jan 2020 11:46: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 S1727112AbgA2Tf5 (ORCPT + 99 others); Wed, 29 Jan 2020 14:35:57 -0500 Received: from mx2.suse.de ([195.135.220.15]:41600 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726683AbgA2Tf4 (ORCPT ); Wed, 29 Jan 2020 14:35:56 -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 F1B98AD72; Wed, 29 Jan 2020 19:35:54 +0000 (UTC) Date: Wed, 29 Jan 2020 11:25:50 -0800 From: Davidlohr Bueso To: dsterba@suse.cz, dsterba@suse.com, nborisov@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] btrfs: optimize barrier usage for Rmw atomics Message-ID: <20200129192550.nnfkkgde445nrbko@linux-p48b> References: <20200129180324.24099-1-dave@stgolabs.net> <20200129191439.GN3929@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200129191439.GN3929@twin.jikos.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Jan 2020, David Sterba wrote: >On Wed, Jan 29, 2020 at 10:03:24AM -0800, Davidlohr Bueso wrote: >> Use smp_mb__after_atomic() instead of smp_mb() and avoid the >> unnecessary barrier for non LL/SC architectures, such as x86. > >So that's a conflicting advice from what we got when discussing wich >barriers to use in 6282675e6708ec78518cc0e9ad1f1f73d7c5c53d and the >memory is still fresh. My first idea was to take the >smp_mb__after_atomic and __before_atomic variants and after discussion >with various people the plain smp_wmb/smp_rmb were suggested and used in >the end. So the patch you mention deals with test_bit(), which is out of the scope of smp_mb__{before,after}_atomic() as it's not a RMW operation. atomic_inc() and set_bit() are, however, meant to use these barriers. > >I can dig the email threads and excerpts from irc conversations, maybe >Nik has them at hand too. We do want to get rid of all unnecessary and >uncommented barriers in btrfs code, so I appreciate your patch. Yeah, I struggled with the amount of undocumented barriers, and decided not to go down that rabbit hole. This patch is only an equivalent of what is currently there. When possible, getting rid of barriers is of course better. Thanks, Davidlohr