Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2782844ybh; Mon, 9 Mar 2020 12:56:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu5cOud9wPj30j6W/Lqrzvb6BR7nF848yFEfPGgPiCHplQrBmUZb/+Sa4kuzjFhIOqLcXmy X-Received: by 2002:a05:6830:3148:: with SMTP id c8mr14120211ots.359.1583783815424; Mon, 09 Mar 2020 12:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583783815; cv=none; d=google.com; s=arc-20160816; b=AI1MVAqVLcfJ+R5WEfs18bXY5oGfgP4rVtRBfS2H8L/fIIC1ukob1g/0s5o3+s/Ajl 8loqqjDcObyY0yLDRoysQZaf3zlwxYZsx6esponuXrDKzJEuPxU0hpjLsvRu29aJp1J6 MLN2bL1+ui4XBY9YL6C/6JHxx52LEW1gKVCzMmP4dvF2YBUgiw1l8vMp9iFQ0ml8zjj+ NfsCbpOf9FskpeVx6XCuRVfzh/eZF75iZZU9i658PT1OLoGGvSx2ZxpTk0ZrlZ+qWl1E odGTe+XXUYu3vz7kse9Jo2Qw26F5vZ+XTWxWaDRNwpq28NKTm2HC9AbwbULY2J4o3IVA 5FuA== 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=HzjYZGQmeF492Ya8cdLt48GEJUCNU8vRfg/kd9UQvvk=; b=sctFliai3H5IraZ6ggMi73OFHfJQqhIJ/6DJuJz185HkQtOYZSX+JxE2wRinNswxlK 81rJBWDLGh8DnR/GKY1Dne5rfGnUeVttfhtXnT47wH2katStvJiWyHWHCknoKQk+9HJj jvTaTnDzF+6pQZJ0QfwFIzwMPfZUvEdXL7Y6lLTaJ8cxm15awvSByhUsQcVsb3G7poJc AlIo37oMZvvz7l2OagF4rDdIKUMdSpOKkqZg8BUe9o8YfIehQV4fWmRRIZ8Y4HYebm7K Pl65xqdZQVxzVWvj9vEn8+7QvnIyeVQdgoy5XvLHpT1AI6ZCn8z8i6tt10KHcHf1evsj 87iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CkAfkl8E; 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 v9si6807737ota.239.2020.03.09.12.56.26; Mon, 09 Mar 2020 12:56:55 -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=CkAfkl8E; 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 S1726385AbgCITxX (ORCPT + 99 others); Mon, 9 Mar 2020 15:53:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:40664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgCITxW (ORCPT ); Mon, 9 Mar 2020 15:53:22 -0400 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (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 E5FB724654; Mon, 9 Mar 2020 19:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583783601; bh=Ys9cb1JHkNT/JukiMIn3m65S++UynbxSWoQSZHr6Kv8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=CkAfkl8EJQFMM8LniV0bpeT891fmQMosJdodc0+Y3xPyKKMDKM/Gbc11CagBpxD0p vHiCsDkA0uId863OTU3y26R+WAsIwVZnfKS9Le49zCWOUiF8R44bY6QnjwnXMxzqrM oigf9U2ZZ8v/euvQ2V47+ZdSf1AiNwYmH5gB8CYg= Message-ID: <3358ab2ca14f51ec36202c9957453c32cba81fad.camel@kernel.org> Subject: Re: [locks] 6d390e4b5d: will-it-scale.per_process_ops -96.6% regression From: Jeff Layton To: Linus Torvalds Cc: kernel test robot , yangerkun , LKML , lkp@lists.01.org, Neil Brown , Bruce Fields , Al Viro Date: Mon, 09 Mar 2020 15:53:19 -0400 In-Reply-To: <1bfba96b4bf0d3ca9a18a2bced3ef3a2a7b44dad.camel@kernel.org> References: <20200308140314.GQ5972@shao2-debian> <34355c4fe6c3968b1f619c60d5ff2ca11a313096.camel@kernel.org> <1bfba96b4bf0d3ca9a18a2bced3ef3a2a7b44dad.camel@kernel.org> 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 Mon, 2020-03-09 at 15:09 -0400, Jeff Layton wrote: > On Mon, 2020-03-09 at 13:22 -0400, Jeff Layton wrote: > > On Mon, 2020-03-09 at 08:52 -0700, Linus Torvalds wrote: > > > On Mon, Mar 9, 2020 at 7:36 AM Jeff Layton wrote: > > > > On Sun, 2020-03-08 at 22:03 +0800, kernel test robot wrote: > > > > > FYI, we noticed a -96.6% regression of will-it-scale.per_process_ops due to commit: > > > > > > > > This is not completely unexpected as we're banging on the global > > > > blocked_lock_lock now for every unlock. This test just thrashes file > > > > locks and unlocks without doing anything in between, so the workload > > > > looks pretty artificial [1]. > > > > > > > > It would be nice to avoid the global lock in this codepath, but it > > > > doesn't look simple to do. I'll keep thinking about it, but for now I'm > > > > inclined to ignore this result unless we see a problem in more realistic > > > > workloads. > > > > > > That is a _huge_ regression, though. > > > > > > What about something like the attached? Wouldn't that work? And make > > > the code actually match the old comment about wow "fl_blocker" being > > > NULL being special. > > > > > > The old code seemed to not know about things like memory ordering either. > > > > > > Patch is entirely untested, but aims to have that "smp_store_release() > > > means I'm done and not going to touch it any more", making that > > > smp_load_acquire() test hopefully be valid as per the comment.. > > > > Yeah, something along those lines maybe. I don't think we can use > > fl_blocker that way though, as the wait_event_interruptible is waiting > > on it to go to NULL, and the wake_up happens before fl_blocker is > > cleared. > > > > Maybe we need to mix in some sort of FL_BLOCK_ACTIVE flag and use that > > instead of testing for !fl_blocker to see whether we can avoid the > > blocked_lock_lock? > > > > How about something like this instead? (untested other than for > compilation) > > Basically, this just switches the waiters over to wait for > fl_blocked_member to go empty. That still happens before the wakeup, so > it should be ok to wait on that. > > I think we can also eliminate the lockless list_empty check in > locks_delete_block, as the fl_blocker check should be sufficient now. Actually, no -- we need to keep that check in. The rest should work though. I'll do some testing with it and see if the perf issue goes away. Thanks, -- Jeff Layton