Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1508523ybh; Thu, 23 Jul 2020 10:33:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7ORnah5pILd4p8SjrW4CPkF8ThjnS09tkelev5YmaS/vMNxlmA0jgaDDTv/baf6eMSHs5 X-Received: by 2002:a05:6402:22d5:: with SMTP id dm21mr5166190edb.26.1595525599037; Thu, 23 Jul 2020 10:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595525599; cv=none; d=google.com; s=arc-20160816; b=bYgIOUKnk7nIFTOeSu+SK8my+d6qNzfX/pQOnv2kqzizKm2llAd7AEUVzL+JtJEFz1 w9L5+VQy27+wZ+VD2/mBWj5RP7hsd9/kbyeiBUXMFGFTe7Jp1nqyd/NRioCUuFgSbrO8 DnDvRkXcRipIzucnyvkgSbXGaxgb7AB9cD2MXgUJ3lHlFyENlrejMnLPQKVFYVjAD4GP Jk5T6u2faNraBYTVx/Z+uyfryLfpY3xbf/Vgw6LGKgecFSUCJxJkgTblXSOPgVRgA6NV S29Lx8JrP+LimZh32G2SREd+ApOKqcYvfpDjIVwb4qMq7ZcfJnUMuACo0Q7aIxZ3h3LQ zuGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5zYkE2fMUPzpDtnOFHRFwbdoB4F8fyP/RyQx4kUy0rU=; b=jRLIgGSEueG87w+1Ta3v25SnsIgM1KUT2V6Mua1cRhJvS1ziNvyBboMYodYmFnJBQa e1VkSjgzDIoWuadJ94erYuVZSuoplMNi0+2HtKsrmJLzibcToweQGL7Lf0hBzw1zTWYh 6pkrecwdhwTWmBUpFd/40Oz4jKjr4k9DztLfM/sp6rKKwM5vHIDX4yOzLSCFc9T/r5zy 2E6i3aYf4ZzZnR1lhYWmwzfcS0TiVM2PJ7NB9RhpLvbIIxLTwDyGYJthR0b+G9FhOl8H eRUu4g6E3FTIdiPoJOd9BcwGCOjMauVm5Vv69WJhR1RuLvM5NIwtkW2lv8oWLiYkO4zD zXRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Bp+4h9iM; 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 g10si2508011edu.361.2020.07.23.10.32.54; Thu, 23 Jul 2020 10:33:19 -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=@linux-foundation.org header.s=google header.b=Bp+4h9iM; 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 S1730037AbgGWRct (ORCPT + 99 others); Thu, 23 Jul 2020 13:32:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbgGWRcs (ORCPT ); Thu, 23 Jul 2020 13:32:48 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4634EC0619DC for ; Thu, 23 Jul 2020 10:32:48 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id u12so3726272lff.2 for ; Thu, 23 Jul 2020 10:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5zYkE2fMUPzpDtnOFHRFwbdoB4F8fyP/RyQx4kUy0rU=; b=Bp+4h9iMj4m/fVv488OdlZ0/KQu4TNZM6LfRO4nxTEcsOrXCt+AKX+lc0iFLbCyADc ie8cAnnFvURkAJ0QFkdq2L1rj21VQV4tO5Qp8sDxzWMr2pfVJptsFBXJcQYNZGz5wtJz XHNTbUy22gwkEX8rouEuDmiDCGfKkvNaEg26g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5zYkE2fMUPzpDtnOFHRFwbdoB4F8fyP/RyQx4kUy0rU=; b=HRPQ6FiD+Gk6nTGd3DMhkS63/Q5H4bRv7GvfXHblPC98pMdtwdXloGJyHC4Txc45Tq ZsMzaEJlmUV2ylnfFubt+G2bYOXr3tmIlu0/cJ4aJFLroow2i8lbl2wUZccJaxfrrQWx TZF1M4mIot5YDtTWtZzLWu2yfZ+wbdmhI/8yX9vuSl7zrDxFyjEV/hv8X3tr58WudjPd 1/VwffraIWvcsYFX20Xn8CchF4kYYCCgrU562F3vGdzE5xW2uTwPdrhkt5pd4sVDkSMf 2WA3n4Pa0uMyu479H4g5baSe4cLyfcFWwUV5rWHNTxmkaYFdkGps/GgsuEYc6/Nfb5V+ daDg== X-Gm-Message-State: AOAM533YLuVmEpThlAGPgCBAFHURp2IkvAAUTNtdhP2MIJGQ2oMwByvI Ad+BTkYZ5qjiRmYUZtYI0JlGrvL9nJw= X-Received: by 2002:a05:6512:2082:: with SMTP id t2mr2872611lfr.142.1595525566372; Thu, 23 Jul 2020 10:32:46 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id d26sm3225612lfq.73.2020.07.23.10.32.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jul 2020 10:32:45 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id h22so7214991lji.9 for ; Thu, 23 Jul 2020 10:32:45 -0700 (PDT) X-Received: by 2002:a05:651c:1b6:: with SMTP id c22mr2177312ljn.421.1595525564657; Thu, 23 Jul 2020 10:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20200721063258.17140-1-mhocko@kernel.org> <20200723124749.GA7428@redhat.com> In-Reply-To: <20200723124749.GA7428@redhat.com> From: Linus Torvalds Date: Thu, 23 Jul 2020 10:32:28 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] mm: silence soft lockups from unlock_page To: Oleg Nesterov Cc: Hugh Dickins , Michal Hocko , Linux-MM , LKML , Andrew Morton , Tim Chen , Michal Hocko Content-Type: multipart/mixed; boundary="000000000000832cd805ab1f3e64" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000832cd805ab1f3e64 Content-Type: text/plain; charset="UTF-8" On Thu, Jul 23, 2020 at 5:47 AM Oleg Nesterov wrote: > > I still can't convince myself thatI fully understand this patch but I see > nothing really wrong after a quick glance... I guess my comments should be extended further then. Is there anything in particular you think is unclear? > > + wake_up_state(target, mode); > > We can no longer use 'target'. If it was already woken up it can notice > list_empty_careful(), return without taking q->lock, and exit. Good point. And yes, I think using WQ_FLAG_WOKEN is the right thing to do, and I wouldn't call it "abuse". It's exactly what it's for. And that also allows us to just use finish_wait(), since we no longer care as deeply about the waitlist state, we can just test that WQ_FLAG_WOKEN at the end instead. So that actually makes the patch much more straightforward too. I really disliked my open-coding there. Your suggestion fixes everything. > do we need SetPageWaiters() if trylock() succeeds ? We need to set it before the final page flag test, because otherwise we might miss somebody just about to wake us up (ie we see the bit set, but it's getting cleared on another CPU, and if PageWaiters isn't set then that other CPU won't do the wakeup). So here's a v2, now as a "real" commit with a commit message and everything. Is there anything in particular you would like clarified, or something else you find in this? Hugh - this should make your "patch 2" redundant. Is there any way to test that in your environment that triggered it? This v2 isn't tested, but the core of it is the same, just with nice cleanups from Oleg's suggestion, and an added comment about that SetPageWaiters() thing. Linus --000000000000832cd805ab1f3e64 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-mm-rewrite-wait_on_page_bit_common-logic.patch" Content-Disposition: attachment; filename="0001-mm-rewrite-wait_on_page_bit_common-logic.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kcz2p3g30 RnJvbSA3MWM0OGYyZTUwZmNkNTZiNmU5NDFiNDZjMGVhN2RkZGQzMGFkMTQ2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFRodSwgMjMgSnVsIDIwMjAgMTA6MTY6NDkgLTA3MDAKU3ViamVjdDog W1BBVENIXSBtbTogcmV3cml0ZSB3YWl0X29uX3BhZ2VfYml0X2NvbW1vbigpIGxvZ2ljCgpJdCB0 dXJucyBvdXQgdGhhdCB3YWl0X29uX3BhZ2VfYml0X2NvbW1vbigpIGhhZCBzZXZlcmFsIHByb2Js ZW1zLApyYW5naW5nIGZyb20ganVzdCB1bmZhaXIgYmVoYXZpb2UgZHVlIHRvIHJlLXF1ZXVlaW5n IGF0IHRoZSBlbmQgb2YgdGhlCndhaXQgcXVldWUgd2hlbiByZS10cnlpbmcsIGFuZCBhbiBvdXRy aWdodCBidWcgdGhhdCBjb3VsZCByZXN1bHQgaW4KbWlzc2VkIHdha2V1cHMgKGJ1dCBwcm9iYWJs eSBuZXZlciBoYXBwZW5lZCBpbiBwcmFjdGljZSkuCgpUaGlzIHJld3JpdGVzIHRoZSB3aG9sZSBs b2dpYyB0byBhdm9pZCBib3RoIGlzc3VlcywgYnkgc2ltcGx5IG1vdmluZyB0aGUKbG9naWMgdG8g Y2hlY2sgKGFuZCBwb3NzaWJseSB0YWtlKSB0aGUgYml0IGxvY2sgaW50byB0aGUgd2FrZXVwIHBh dGgKaW5zdGVhZC4KClRoYXQgbWFrZXMg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