Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1590111pxa; Thu, 6 Aug 2020 11:01:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnxTD57YYJrT6BdEDY061i5Qs0ETfkD6Je+Vye3RVOgmRjlCzULW3mA3wlkAdi0GT0ogh8 X-Received: by 2002:a17:907:724b:: with SMTP id ds11mr4059238ejc.481.1596736888093; Thu, 06 Aug 2020 11:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596736888; cv=none; d=google.com; s=arc-20160816; b=q/jbmu/qKZDz0Xx9cvtYXIyYGHpaCw8Hkz7ouwef4f0rdV/dRGdn4LNf4DP+LTHLwA /TH5ObMTsPeEIVU1dVSF696y2aRbITGNH25Jp2D7Wl1Ri6Cpyl674s8JVKCPM8WDHZRV Ov4sAFznHuv7lxXlaMbwNgTOrFatF6jIwrKd/dDffOPO3C87j9J75b2LX8RRscBe/QV2 ClEmj5l82aJmZUoqnhuLh8RU0Nwe+iiMcY+k1GhmhU/JVuOCW/A+cqgz3c0PXr1WTETf /k/jmMVmxYZ3GeNbqnFtLu1wHZLO5zmrBdlq43VWdn8XRxgO/NEMesvCq8f8o3CstnsV Pj8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MT2ki/o/y2NYLP7okz7irOUiWq3okJ0oQaW4u8dEtZ8=; b=un852sCZp4t7A7Vfs3WUvkc7xkvaMyvoZ7mWZ0kL0LboMZ4VFtzjEQNXFo0ajPGCyY hIwafg0TgiQtplzTIA+VZsJQLkDe1trWSXeD8Mz5Sgpum59/Kc0+07GvuA+jahbpbBbE Sn739UlmG7s3Vopn2scxEUgmT1b+Mk+y3iUMn5u+bh+XcV160MM79QbNpz3/QRylw2oF aC4R3J3TcQ3yrzEpKtxKnY2AbZaSHElNSwJQ85CYi69Urhz/9T+p9rT/6rQ59ULNBFw7 dYcaDsjSRzCV5AGVfqOQqAz+Cd034J/BJUXn4QhVNbcX+Ot7Hl/VzSWjKOJHr8XpEU3v MR6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=csMUSrDv; 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 y18si3613645edq.221.2020.08.06.11.01.03; Thu, 06 Aug 2020 11:01:28 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=csMUSrDv; 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 S1727843AbgHFSAf (ORCPT + 99 others); Thu, 6 Aug 2020 14:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbgHFSAe (ORCPT ); Thu, 6 Aug 2020 14:00:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079DCC061574 for ; Thu, 6 Aug 2020 11:00:34 -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=MT2ki/o/y2NYLP7okz7irOUiWq3okJ0oQaW4u8dEtZ8=; b=csMUSrDvvlCdx4/Ssvp4kGJ1TP hb8CaqPBTZ0O6u68hn+qsG4db4LRN2L9ruW/eoh+735CKrmBOPiKcOwMWmilgOcj59zdVjMbGzIVd 6LJ9QGeUu74MwL03AW1zgIOKemRZHL0lm+slWK6gnSFuWZ+0mQdIaMd9Ws1Z/wHXukNj/oo1eVuIW /+rYYtfZ+iBiyS9aX9GIQvrR7ewNTl4X2/kigsQYm98XrU3amMXE2HfECxXFW750jaFDcmKszXWQP rF3QRj7zout7ThNZg9lS55fU0aKje9K4e+28hjVV5tZMLZB01cs+kR/TrEQE+irvMA6gqU4BJkJ44 zGudRwug==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3kBk-0007g8-HC; Thu, 06 Aug 2020 18:00:24 +0000 Date: Thu, 6 Aug 2020 19:00:24 +0100 From: Matthew Wilcox To: Linus Torvalds Cc: Hugh Dickins , Oleg Nesterov , Michal Hocko , Linux-MM , LKML , Andrew Morton , Tim Chen , Michal Hocko , Greg KH Subject: Re: [RFC PATCH] mm: silence soft lockups from unlock_page Message-ID: <20200806180024.GB17456@casper.infradead.org> References: <20200724152424.GC17209@redhat.com> <20200725101445.GB3870@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 10:07:07AM -0700, Linus Torvalds wrote: > On Wed, Aug 5, 2020 at 10:21 PM Hugh Dickins wrote: > > Something I was interested to realize in looking at this: trylock_page() > > on a contended lock is now much less likely to jump the queue and > > succeed than before, since your lock holder hands off the page lock to > > the next holder: much smaller window than waiting for the next to wake > > to take it. Nothing wrong with that, but effect might be seen somewhere. > > Yeah, the window is smaller, but it's not gone. > > It *might* be interesting to actually do the handover directly from > "unlock_page()", and avoid clearing (and then setting) the bit > entirely. > > Something like the attached TOTALLY UNTESTED patch. > > NOTE! Sometimes when I say something is untested, I think the patch is > fine because it's simple and straightforward, I just didn't test it. > > This time it's both untested and very very subtle indeed. Did I get > the hand-over case SMP memory barriers right? Did I screw something > else up? > > So this might be complete garbage. I really don't know. But it might > close the window for an unfair trylock (or lucky page_lock()) > entirely. It wasn't clear to me whether Hugh thought it was an improvement or not that trylock was now less likely to jump the queue. There're the usual "fair is the opposite of throughput" kind of arguments.