Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp132104ybh; Fri, 13 Mar 2020 18:32:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtQ5JkkeAq88zNWtqMWLurMm8UxnIN+KnSD2C9xm2FHtS+ZohldHkcZGvC0O2o846qf9HCm X-Received: by 2002:aca:37c3:: with SMTP id e186mr9629723oia.155.1584149557341; Fri, 13 Mar 2020 18:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584149557; cv=none; d=google.com; s=arc-20160816; b=SpsMM+gic+IhFX62WC4o06NDVlNxka3IqXHAOIVu8nV0y0yid4BFN4YaHkpq9N7G// zX76EUgJ0Zus/f1yVexrU63OFK4gyN7CxdIO1VxByd/+wxFk+VkKrE/ZzBlOGYCn6sA2 Bcdso2OkMiaoSLmoNoMJhZSFUZ55cHiH0Vl/hFsPJJ17JgnMFo5TZUydJIKNefl7r9// Y9IS3BuPeX2nFoecWKuOphfnqkRf/ROQb+kzMfpMi3+/UK+xNGRdlh562s/DubYPK2dj JYKh5CKSRNjYLRQQACM3FKGX5IjlHbLhu/YmEMk+qduBngZHkgf8dGZRFgEk4vJ0xdCD gidw== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=zVts81PQs9G1SNJHrWQIjE5JrwjPYzjSpoo4hVnzZyk=; b=aLoHmV0izmmLUuh1kGNOpwEW0+Qb+BTMZQZhemd27T2GNPfiFRbgUiXX3qZPTzHYmU yY1XYG0SqeS1DPhvZuF9ljQ2B8WbviTgkz9C2YYbps0wAct9gjCEx4k5SEE6itASMss2 HXGB2AXGLXDkC9Bwsk+EpHfSwBOPYmZyhzfkn8br+1ykoTp+lhdUiPlRa2qZoH45rO82 R7aOHlugobVVyl8p28u/GZCQ9wHWLy0B2W6+jHj0dPbc+ZyxEQ/hwctHd7oXYmSniV8W nXDK1y3CXrbsfb+5LNm0VcSI8Fr9prNn7ZNGmCeTeaqymVm9f9n8i+49F0MadVzwMk22 vavw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UBa7Ndar; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o25si5935912otk.28.2020.03.13.18.32.23; Fri, 13 Mar 2020 18:32:37 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=UBa7Ndar; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727751AbgCNBbk (ORCPT + 99 others); Fri, 13 Mar 2020 21:31:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:35046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbgCNBbj (ORCPT ); Fri, 13 Mar 2020 21:31:39 -0400 Received: from vulkan (unknown [170.249.165.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E56502074B; Sat, 14 Mar 2020 01:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584149498; bh=hJwyPIvd2ZUJsqiZqnhUbplLGWikush9KMDaDbjWR8Y=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UBa7NdareUhiW2HFF+N2f47mKVFH7Rnoi+b8Y/F8UriSPIFxe95DQDkwdCkTbyTfl 0foyXMZ3R7kwX7DbERZZg6BQGHoerUFdMWbja5+22/op+ZWcEB9MrWLPamozEg36i9 0ExpVOm0cS4C4IdC9kjiei8NqvkO70Wf9vThE1t0= Message-ID: Subject: Re: [locks] 6d390e4b5d: will-it-scale.per_process_ops -96.6% regression From: Jeff Layton To: Linus Torvalds , NeilBrown Cc: yangerkun , kernel test robot , LKML , lkp@lists.01.org, Bruce Fields , Al Viro Date: Fri, 13 Mar 2020 20:31:36 -0500 In-Reply-To: References: <20200308140314.GQ5972@shao2-debian> <34355c4fe6c3968b1f619c60d5ff2ca11a313096.camel@kernel.org> <1bfba96b4bf0d3ca9a18a2bced3ef3a2a7b44dad.camel@kernel.org> <87blp5urwq.fsf@notabene.neil.brown.name> <41c83d34ae4c166f48e7969b2b71e43a0f69028d.camel@kernel.org> <923487db2c9396c79f8e8dd4f846b2b1762635c8.camel@kernel.org> <36c58a6d07b67aac751fca27a4938dc1759d9267.camel@kernel.org> <878sk7vs8q.fsf@notabene.neil.brown.name> <875zfbvrbm.fsf@notabene.neil.brown.name> <0066a9f150a55c13fcc750f6e657deae4ebdef97.camel@kernel.org> <87v9nattul.fsf@notabene.neil.brown.name> <87o8t2tc9s.fsf@notabene.neil.brown.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-03-12 at 09:07 -0700, Linus Torvalds wrote: > On Wed, Mar 11, 2020 at 9:42 PM NeilBrown wrote: > > It seems that test_and_set_bit_lock() is the preferred way to handle > > flags when memory ordering is important > > That looks better. > > The _preferred_ way is actually the one I already posted: do a > "smp_store_release()" to store the flag (like a NULL pointer), and a > smp_load_acquire() to load it. > > That's basically optimal on most architectures (all modern ones - > there are bad architectures from before people figured out that > release/acquire is better than separate memory barriers), not needing > any atomics and only minimal memory ordering. > > I wonder if a special flags value (keeping it "unsigned int" to avoid > the issue Jeff pointed out) might be acceptable? > > IOW, could we do just > > smp_store_release(&waiter->fl_flags, FL_RELEASED); > > to say that we're done with the lock? Or do people still look at and > depend on the flag values at that point? I think nlmsvc_grant_block does. We could probably work around it there, but we'd need to couple this change with some clear documentation to make it clear that you can't rely on fl_flags after locks_delete_block returns. If avoiding new locks is preferred here (and I'm fine with that), then maybe we should just go with the patch you sent originally (along with changing the waiters to wait on fl_blocked_member going empty instead of the fl_blocker going NULL)? -- Jeff Layton