Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6495045iob; Tue, 10 May 2022 21:31:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUaqQxWzGTql/C0yvcd4QVkqz13KdGh3HnWBTR+85VmDHEvb/hGkvvkE1QecNmmyJZTfMQ X-Received: by 2002:a17:907:7f1f:b0:6fa:2704:c601 with SMTP id qf31-20020a1709077f1f00b006fa2704c601mr13331257ejc.496.1652243477310; Tue, 10 May 2022 21:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652243477; cv=none; d=google.com; s=arc-20160816; b=tKnBzTOd6UBWOaVS8bg539ME9HDrfzVZ7glaq21kMjEEhBgIA2N7JPoswPpwv7+aQ5 xH4NXA4ylo69e0bqjwjttDBdQNd5HIacoFPefKrWLmhZhAnPg55iMGDAGsQDwoyFmEAd TDxaEqhp4LXc0SCC1k2PZvT+ch6iRT5cZqixXqRr93g/xYwcQA95O+hW4GZr2XfAQCu+ TpbgzRX95Uc45VAxUOSS+sLeGJOziG2JPUmalGteao6orwsw2RZVX/mOh4J/8gX/oSba ujG2iC+vQxt3sBpIDUH6C0gLPc8MrA0IgsZEmYa+QzwdUag44lvEs6VlTWdpbAHR20J/ ZJ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lsBeHLglJOApYF654Jir26FeEjZ4KihltVOnJfCQAmM=; b=fuBJTM0uVCjDEwmTdPKwcPpJj5tGYHhm36hU0/aCAS69Hz9hJkCJUUiUQBPwqRji8Y 57CYaqdnKb6hTE8wEUKfWdCFF6El60/Tr+LoOSfejdY3knpqQqpIha4UBf2UEMhzmkOY eOqcDgyKRgNyM5T2wgYilH9nmWWcze2g8AjksTQGwNBlSO9nJ0roVXww5GbfOEq8IptB a+IzYFed6MdhYisFNsETDRnrmvwzrbZUxK0l4uUa2vlX9dcdoUp6swlZiFdefHvZ3GtJ i+EOniGByIJzwTcjJ1HLdmjwUGbsNB0MpNNbnKsWKAIXTdVcEyf+TlbtLoaLJYCXBOib fZrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GKSgMglU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r25-20020a170906c29900b006e8666ecf83si1562423ejz.144.2022.05.10.21.30.51; Tue, 10 May 2022 21:31:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GKSgMglU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbiEJT2d (ORCPT + 99 others); Tue, 10 May 2022 15:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241186AbiEJT2M (ORCPT ); Tue, 10 May 2022 15:28:12 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCAE356416 for ; Tue, 10 May 2022 12:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lsBeHLglJOApYF654Jir26FeEjZ4KihltVOnJfCQAmM=; b=GKSgMglUZZSziABl1xao9QbCdV aqxXhDHJ+8IRYN+Xq5ApUGjIzskCJY0HPTaukl7TVbQk1Ii9nAS5I0ZLjfLIZVuCa9+0HnruKfQS8 ThDgkOAf/CWorsNa+06o6GjrDWpxVNkIEPajpdj7ouBz8aKetOHoHN99PdZKBBMEXdaDoNf9NLimP i/oXHlbjNdcy9tM5MQELU5fxUMZKVpjkUHsN+pYzMFlifx6g1rFqQxR+cr0XHOhG+5t+Ucd+TGYU1 TKFfCItNd7OfSdnhCQBWe8wJB6IMX9N2/N6t3CpZ9vUShr7TuTO7va2ELvPVEnI3WsBdVzdys7Jev n5vgRQQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1noVVm-004jum-DB; Tue, 10 May 2022 19:27:10 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 3AE5A98100A; Tue, 10 May 2022 21:27:08 +0200 (CEST) Date: Tue, 10 May 2022 21:27:08 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: "ying.huang@intel.com" , Waiman Long , Will Deacon , Aaron Lu , Mel Gorman , kernel test robot , Vlastimil Babka , Dave Hansen , Jesper Dangaard Brouer , Michal Hocko , Andrew Morton , LKML , lkp@lists.01.org, kernel test robot , Feng Tang , Zhengjun Xing , fengwei.yin@intel.com Subject: Re: [mm/page_alloc] f26b3fa046: netperf.Throughput_Mbps -18.0% regression Message-ID: <20220510192708.GQ76023@worktop.programming.kicks-ass.net> References: <7d20a9543f69523cfda280e3f5ab17d68db037ab.camel@intel.com> <37dac785a08e3a341bf05d9ee35f19718ce83d26.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2022 at 11:05:01AM -0700, Linus Torvalds wrote: > I think from a pure lock standpoint, it's the right thing to do (no > unnecessary bouncing, with the lock releaser doing just one write, and > the head waiter spinning on it is doing the right thing). > > But I think this is an example of where you end up having that > spinning on the lock possibly then being a disturbance on the other > fields around the lock. > > I wonder if Waiman / PeterZ / Will have any comments on that. Maybe > that "spin on the lock itself" is just fundamentally the only correct > thing, but since my initial reaction was "no, we're spinning on the > mcs node", maybe that would be _possible_? > > We do have a lot of those spinlocks embedded in other data structures > cases. And if "somebody else is waiting for the lock" contends badly > with "the lock holder is doing a lot of writes close to the lock", > then that's not great. The immediate problem is that we don't always have a node. Notably we only do the whole MCS queueing thing when there's more than 1 contender. Always doing the MCS thing had a hefty performance penalty vs the simpler spinlock implementations for the uncontended and light contended lock cases (by far the most common scenario) due to the extra cache-miss of getting an MCS node.