Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3292160pxj; Tue, 11 May 2021 00:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGOqV7IZjZggTGvpue5otPXmCbr3UDsRs1Juf0TjuIV9zASEJCV3hzGWpBc9YRZFecvoRQ X-Received: by 2002:a6b:7413:: with SMTP id s19mr20744123iog.151.1620719255066; Tue, 11 May 2021 00:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620719255; cv=none; d=google.com; s=arc-20160816; b=XKItVN5qAz3R0813xnrr6R9pA9BQZiaP8cX71deFn3UDlFIutynUgtNlyyBEvo/8VG GGbbrsqgZJv4yqtuVuQKLkS6naOAUCjJ2MOHwhoPw24e6pOBK2uHZcMVFgSb05H0DI9n 3JDHvXmCHHsP2pYB6lRBf5oSpy52/As6z7hZGSv4yprNKFbJmenioIt4RvOAsIefSTT7 m0+knar5jaZOUxGJj1YILzkaIgj/GvPinwyyU7tgwsEfPKzyIz34aaIlYCtbhLaRnA1V XANZDUZr/IpLYlJZOfC9bkSCi+4oxOEtDDPAxSgDIqZYTzmuFT2w21MhfwC5iQtLVvZE tAeg== 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=IH4rmQ69j2Fl6JxxC9cJyX9AxXhBsr98IbbacKhqIvM=; b=If3YaRh9lrvvdig2kdACVPtVbrEF04FGxpsyU2rUFF5Fyemi5iqDKkcHiaUiAU2Tfp FUvIXFNnJVOANPMpelvFf1yJlSxkX+yYcSBbiO653LtXr3Yl/zsFReWB/2NuAzXaidlC O6hxfmXvFnuzRpJibE+37LySn2BZhR5Vqp/AZC27CRyMUWJ6C01fLmfQo8Ltl033dARI 4Oh3GMRvBqn5GzFIzTkqm48xa7ghJt6OBaiaS8wShwl6ApN9BffoT4I3vMEXpkrUzQij K2BXvwPw9YVphHAueagH/zzkOTO2gV1MZRLeq7j2iBxHPqYvGiDPgGvMF501iPU4XxKI mWtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qi3xwOZ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si12655716ilu.28.2021.05.11.00.47.22; Tue, 11 May 2021 00:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qi3xwOZ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbhEKHrp (ORCPT + 99 others); Tue, 11 May 2021 03:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbhEKHro (ORCPT ); Tue, 11 May 2021 03:47:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFE48C061574 for ; Tue, 11 May 2021 00:46: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=IH4rmQ69j2Fl6JxxC9cJyX9AxXhBsr98IbbacKhqIvM=; b=qi3xwOZ9HiLAagKybL1W+Ska+8 mQlewraGSGeKqo0VAqIASaeP8ohM59EKr/llcnqy9S/NL8ZHHLsDqJRVHCM0DOFGDTrbqD8wch7V2 6mtWtUeSnDkDMpU64lw7VJ8ex5OemtdgwzG3zwrJKMTEx4fRxQKnIpcwZV+VhkfCRpPLbGWWF2QMd c4Augr4qMRd8NFfBMzI6y1F/aIUbTB+gNXStldO+c32G8Yt2UbUpNb88/OF03XMi4zOrPFs1ueUPn sfLU/UU4H8EVFfPIubhixea+YB39eOq1pCzUCdO++B7re/x3EIzQaM6BvVw9WNAfN6oNzTKqZzwGq 3HlMDWhg==; 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 (Red Hat Linux)) id 1lgN5l-0073br-BY; Tue, 11 May 2021 07:46:11 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 6A2B99871B5; Tue, 11 May 2021 09:46:05 +0200 (CEST) Date: Tue, 11 May 2021 09:46:05 +0200 From: Peter Zijlstra To: Matthew Wilcox Cc: Thomas Gleixner , neilb@suse.de, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/17] locking: Add split_lock Message-ID: <20210511074605.GC5618@worktop.programming.kicks-ass.net> References: <20210409025131.4114078-3-willy@infradead.org> <87blaj1sqf.ffs@nanos.tec.linutronix.de> <20210412144525.GM2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210412144525.GM2531743@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 03:45:25PM +0100, Matthew Wilcox wrote: > On Mon, Apr 12, 2021 at 04:29:28PM +0200, Thomas Gleixner wrote: > > is to have a place to stick the lockdep map into. So it's not a lock > > construct as the name suggests, it's just auxiliary data when lockdep is > > enabled. > > That's the implementation _today_, but conceptually, it's a single lock. > I was thinking that for non-RT, we could put a qspinlock in there for a > thread to spin on if the bit is contended. It'd need a bit of ingenuity > to make sure that a thread unlocking a bitlock made sure that a thread > spinning on the qspinlock saw the wakeup, but it should be doable. queued_write_lock_slowpath() does more or less exactly what you describe. I just worry about loss of concurrency if we were to do that. Where currently we could be spinning on 5 different hash buckets and make individual progress, doing what you propose would limit that. Imagine having one bit-spinlock taken and another cpu contending, it would go into the queue. Then do the same with another bit-spinlock, with another two CPUs, the second again goes into that same queue. So now we have 2 CPUs owning a bit-spinlock, and 2 CPUs stuck in the queue. Suppose the second bit-spinlock is released, this would make the queue-tail elegible to aquire, but it's stuck behind the queue-head which is still waiting for its bit-spinlock. So it'll stay queued and we loose concurrency. Anyway, I think all this is worthwhile just to get bit-spinlock lockdep coverage. And it's not like we can't change any of this when/if we get a better idea or something.