From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80AA8C433E0 for ; Thu, 6 Aug 2020 18:00:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B469320678 for ; Thu, 6 Aug 2020 18:00:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="csMUSrDv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B469320678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB29A6B0002; Thu, 6 Aug 2020 14:00:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A634B6B0003; Thu, 6 Aug 2020 14:00:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9797B6B0005; Thu, 6 Aug 2020 14:00:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id 8307C6B0002 for ; Thu, 6 Aug 2020 14:00:36 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EBCE08249980 for ; Thu, 6 Aug 2020 18:00:35 +0000 (UTC) X-FDA: 77120908830.03.step40_4e0e38926fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 67E6512B59 for ; Thu, 6 Aug 2020 18:00:33 +0000 (UTC) X-HE-Tag: step40_4e0e38926fb9 X-Filterd-Recvd-Size: 3827 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:00:32 +0000 (UTC) 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: X-Rspamd-Queue-Id: 67E6512B59 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.