Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6422371iob; Tue, 10 May 2022 19:04:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0vbnZcGgh6Cp9BdBtqr1MKWuCkOJMP68VuXmj5n3IQHfHwuS2QYSSoT3g8DiDW9/VzbOi X-Received: by 2002:a17:906:4fd5:b0:6f8:5aa9:6f13 with SMTP id i21-20020a1709064fd500b006f85aa96f13mr18085612ejw.267.1652234653607; Tue, 10 May 2022 19:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652234653; cv=none; d=google.com; s=arc-20160816; b=emas6plYQhqt4EL3lS1MaZO49l34lIzhu72YP/fb7a1n6IlwokIyRjEMk9UXR6jFVh n1unPmSd49y6zQ+nF10zoMXwUlAmWfzx/bW4cNSLtMrgEbGa3OSQTS0OCAUpmVWxNd2l gVyqVaMYBRBwLGQjPHrxIAH0IQjKvOk5MzQVSUjW8xevKF8q18DxC6MbfVScUljBndER sdlw1mFTTIQ4gV97WvbyG3UbEefD/CujUFHEqfs0zzzDssG1jqPMEaDYhfI2JO3cj7Pi AlGYikUr4D2K/+Dc7wWPYRecqaPCYVuV7dm1scfnUoejjtNtrG3zn9EFkT+XxLh1SNj5 nxWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lDaf3WbpWZER89SWe3+3un2eTu5W4KfGxQhX3Ozl0ck=; b=ZLF8DpsUkBV5wqMKbsztKIJCUfP8qhS1ghzBuAP99UvOiDal2dVik3uqm+PW7WjU29 luI4A8knX2lnYQf36wGlllLXC4enqN7DzeQ1u452/6mMfXqP99h50hZKoX73h9WjpjWI 1H2MnVQjuQYyjCy9qU6b7Tp57Jzf2CcegrWor3V0c/UeC1NWP9LpCCdNk0VmicYL26ad Qjp5gT5KOFbeE835WxLq3tSZiWogTErJBnA24Ac2hRq+UP3CxDO4J1RK/BIB7XQ0YvBs Dsyx9D2phhx1PhKMi0vQwEqw470aw6Fs/Y0tA6ulPOPqgzSW7ifMAwHwZyIvGPDwTk2q KaZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gj4lhj9E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf30-20020a1709077f1e00b006f3b1db5347si909721ejc.950.2022.05.10.19.03.47; Tue, 10 May 2022 19:04:13 -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=@redhat.com header.s=mimecast20190719 header.b=gj4lhj9E; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345023AbiEJStG (ORCPT + 99 others); Tue, 10 May 2022 14:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349156AbiEJSrJ (ORCPT ); Tue, 10 May 2022 14:47:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E6F1488BF for ; Tue, 10 May 2022 11:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652208426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lDaf3WbpWZER89SWe3+3un2eTu5W4KfGxQhX3Ozl0ck=; b=gj4lhj9EmMcwSE3d9fgxqAbxJTiQGQoYK0znMA7AEc7ojB0iGLj9wlmP513nBOmBkhmoWF rnNz6DWXM/dLv6777YLd7ZYkGKz1LiN7JTB6rhhk4ATnTNXNrYaKZtCmKIl8RsvC6R6rTP fTlkfXXqfBHcjm8LJZ9Kj3/3aLHEyG8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-Rr2WiEDLMQCstKY51qfaRw-1; Tue, 10 May 2022 14:47:03 -0400 X-MC-Unique: Rr2WiEDLMQCstKY51qfaRw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9AF8811E7A; Tue, 10 May 2022 18:47:02 +0000 (UTC) Received: from [10.18.17.215] (dhcp-17-215.bos.redhat.com [10.18.17.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33974401E74; Tue, 10 May 2022 18:47:02 +0000 (UTC) Message-ID: <56474c28-e62a-36b1-257b-9e5ffb11b0e2@redhat.com> Date: Tue, 10 May 2022 14:47:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [mm/page_alloc] f26b3fa046: netperf.Throughput_Mbps -18.0% regression Content-Language: en-US To: Linus Torvalds , "ying.huang@intel.com" , Peter Zijlstra , Will Deacon Cc: 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 References: <20220420013526.GB14333@xsang-OptiPlex-9020> <7d20a9543f69523cfda280e3f5ab17d68db037ab.camel@intel.com> <37dac785a08e3a341bf05d9ee35f19718ce83d26.camel@intel.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 5/10/22 14:05, Linus Torvalds wrote: > [ Adding locking people in case they have any input ] > > On Mon, May 9, 2022 at 11:23 PM ying.huang@intel.com > wrote: >>> Can you point me to the regression report? I would like to take a look, >>> thanks. >> https://lore.kernel.org/all/1425108604.10337.84.camel@linux.intel.com/ > Hmm. > > That explanation looks believable, except that our qspinlocks > shouldn't be spinning on the lock itself, but spinning on the mcs node > it inserts into the lock. > > Or so I believed before I looked closer at the code again (it's been years). > > It turns out we spin on the lock itself if we're the "head waiter". So > somebody is always spinning. > > That's a bit unfortunate for this workload, I guess. > > 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. Qspinlock still has one head waiter spinning on the lock. This is much better than the original ticket spinlock where there will be n waiters spinning on the lock. That is the cost of a cheap unlock. There is no way to eliminate all lock spinning unless we use MCS lock directly which will require a change in locking API as well as more expensive unlock. Cheers, Longman