Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1163940ybh; Sat, 14 Mar 2020 19:50:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtDU3IiHIszOG1TPtjNq09rujpPV6+U9p7uuXNVNEPhW1qLu+CfJrMBAQ7cghAK9VuD11/b X-Received: by 2002:aca:7506:: with SMTP id q6mr12726297oic.73.1584240622533; Sat, 14 Mar 2020 19:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584240622; cv=none; d=google.com; s=arc-20160816; b=x1hGn797p7yrqekAyuRXkFw81VBGzsHH9G5qxjflztczcLk58sNGgEqONZ6/w98D9T /WM/xLSORSNwbwITfJv2TjxXbTVlBFG99yFRhtuJwO90SRKsM8iMAgoxsw+d8Ed4LHt0 iVJpHVICZig7bRQ3AYsfPV+d3EDMjlKdGW47/IMYm9BL9R+GuiWOFRqxj/SCx9wJWy9c PUn6tGLU8MLkex0BsrFlkQpQSidv8+szJjURp5N9K1jMJ1NEfKAKspZh6L1K7mv5ey2c CmDIiEExWc37AAetkSJm/Zy/zkY8G4vQiKkL3Te0SO0oKU73uUg8wzkDFwBBt9kVv9l4 PsgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gNAFSM2e1+znwd/oK9GqPEFWnZPCXJOYSC3o4R7VRNY=; b=ZflJ7s1baTD3WU76Ya9tFLP87sNMgcerjfBBk19UcRpEbRDFEuWVz8eEnWzNKO8PLH t5acjYWM+3YG4zS98gPFQpiTYEmLSC5GOCr5YBCDav8VsTwvWy9Dup9PuJdRweqpHyR2 Pgf4T+bhTgBKorUFpgxWQLqjHCO3wHxmPokUCEQCWcb/W7wDHBFLlmObHmgwdZTMs7i8 2Y2MBUif2yvRki6ynl4hDoOJ6yS+xuwjk5uBrTqNIjUIcKey86JqgOV3z3CpNIZDIFwV 2DvSOkOiG0+ur739tdRo6UHm8rka37FwL6gajqlLFtEbeG3930yYCX86ZYJ7n//h57A5 cgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XmKJHhBn; 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 d19si1873532oic.28.2020.03.14.19.50.10; Sat, 14 Mar 2020 19:50:22 -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=@linux-foundation.org header.s=google header.b=XmKJHhBn; 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 S1727607AbgCOCtS (ORCPT + 99 others); Sat, 14 Mar 2020 22:49:18 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40612 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbgCOCtS (ORCPT ); Sat, 14 Mar 2020 22:49:18 -0400 Received: by mail-lj1-f194.google.com with SMTP id 19so14785308ljj.7 for ; Sat, 14 Mar 2020 19:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gNAFSM2e1+znwd/oK9GqPEFWnZPCXJOYSC3o4R7VRNY=; b=XmKJHhBn38vYPYW5Qw9NYbOmHlLhlGbMUnho47mHIiguKzuelMDN6CDf+xfm0al7z0 mhcACnrAah8QVEpIZpnR9mCR0ilV+pTCciPD61XwhA2JptKErlcb+6K96hJ8XT5oymeB WnZpWU1cbZc0qURpjpCma+Gj+Ll56cjVy3Bmo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gNAFSM2e1+znwd/oK9GqPEFWnZPCXJOYSC3o4R7VRNY=; b=lVexekRwaIg8W3QqoAtOZv/cvZkbHrVsIgYKbZzN1HD3w7ICnZ6QTojYqbTN4QPYHd aBb0O7d22VHJevxru4Cc6RbnNmT1FpJmLA36h3wLTVNPiKtkUIKW8fZ5MbUOVYffNpa+ W8gWVTruVtCmEOpiM4x4APeXPHquOJrYTvYWz9kjxliJnK8mxjFRry7lxRl3qcfYglK7 gY6Pi/7VmECyILdYyYxoZyqsopmK7/3T+8gG3mx40zT+yJIHH5CKfRpP+IU2EOGikh8b w4JMUgV/1KsFx7+fvo9xXVDg6yeI3LyA/fRf//cCzWWOzj6kSF5jyLkKwYPYIDIvnUz5 StUQ== X-Gm-Message-State: ANhLgQ0w5x8fI0MLoCMhEWC9ys9eFQcSsM9BD3vbABxSWMdRpWC97Wgq IzkYNsYtsctqGizJtnJ9MeiuNJ0JHLg= X-Received: by 2002:a05:6512:31d3:: with SMTP id j19mr11623730lfe.178.1584201502855; Sat, 14 Mar 2020 08:58:22 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id g25sm31198182ljn.107.2020.03.14.08.58.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Mar 2020 08:58:21 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id f13so13912897ljp.0 for ; Sat, 14 Mar 2020 08:58:21 -0700 (PDT) X-Received: by 2002:a2e:6819:: with SMTP id c25mr11582038lja.16.1584201500891; Sat, 14 Mar 2020 08:58:20 -0700 (PDT) MIME-Version: 1.0 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> <877dznu0pk.fsf@notabene.neil.brown.name> In-Reply-To: <877dznu0pk.fsf@notabene.neil.brown.name> From: Linus Torvalds Date: Sat, 14 Mar 2020 08:58:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [locks] 6d390e4b5d: will-it-scale.per_process_ops -96.6% regression To: NeilBrown Cc: Jeff Layton , yangerkun , kernel test robot , LKML , lkp@lists.01.org, Bruce Fields , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 13, 2020 at 7:31 PM NeilBrown wrote: > > The idea of list_del_init_release() and list_empty_acquire() is growing > on me though. See below. This does look like a promising approach. However: > + if (waiter->fl_blocker == NULL && > + list_empty(&waiter->fl_blocked_requests) && > + list_empty_acquire(&waiter->fl_blocked_member)) > + return status; This does not seem sensible to me. The thing is, the whole point about "acquire" semantics is that it should happen _first_ - because a load-with-acquire only orders things _after_ it. So testing some other non-locked state before testing the load-acquire state makes little sense: it means that the other tests you do are fundamentally unordered and nonsensical in an unlocked model. So _if_ those other tests matter (do they?), then they should be after the acquire test (because they test things that on the writer side are set before the "store-release"). Otherwise you're testing random state. And if they don't matter, then they shouldn't exist at all. IOW, if you depend on ordering, then the _only_ ordering that exists is: - writer side: writes done _before_ the smp_store_release() are visible - to the reader side done _after_ the smp_load_acquire() and absolutely no other ordering exists or makes sense to test for. That limited ordering guarantee is why a store-release -> load-acquire is fundamentally cheaper than any other serialization. So the optimistic "I don't need to do anything" case should start ouf with if (list_empty_acquire(&waiter->fl_blocked_member)) { and go from there. Does it actually need to do anything else at all? But if it does need to check the other fields, they should be checked after that acquire. Also, it worries me that the comment talks about "if fl_blocker is NULL". But it realy now is that fl_blocked_member list being empty that is the real serialization test, adn that's the one that the comment should primarily talk about. Linus