Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1731190ybh; Thu, 23 Jul 2020 16:44:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUJDLPFUeqdd1GXNCJA7/ljnSIfNYWDY4IpaKI2uiiY6doX801/FvfNvGlb+G12sR/vyni X-Received: by 2002:a17:906:6499:: with SMTP id e25mr6634846ejm.352.1595547847709; Thu, 23 Jul 2020 16:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595547847; cv=none; d=google.com; s=arc-20160816; b=p4lWtmDBKTCY/3TB43lx2SdjXaOUBQxF0T5Mp7vUPZtXPeXqf8JINkV2Y6oXNewEaA nofSxU0fOdQOJnphEvNSz5yx8w36zwhQ9uYYfmLFZfaF7YBNKNarpmHaA+HFIzT+1010 J0/ViJUqFUft8fNsxkAi/nM0HAT4imDqq8g2DQmAuHSugs61oMa0NJ6FAVxAWGdLf/t4 GNXqfIVb/2cOaWGj+O41guOFYFj2ZveyADp9lHSrcGmHYC+b+8+jlFAe6A+6wkim8YU3 wI27SfCY2JAF+r9MAs42kq7mxjFQBbCqGfYRkvr51B+Oie5lisT8rdaocV187JqHZL/8 Nupg== 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=7V/kDihgL5kEC4lQSCSY3jEHwZPrFwJNpyNc4Cr/ySQ=; b=eXPs+qz+7knrjheZX4rWwPoMPvZqYaxTbMwWxFYQvHi0kvsMNNw6vDB37aBxDgNk8b BXSGDO80FgZgK//xUHklMhm9RZ67erSYvElo79odvs3z3b50d9nEiv5zLkzCyHv6tpvM HECXycTyf853tCATx0acsHdIhUfu0w+NemrSRNAxN7uP2RnRSVwhh5tSXaRdBt9NvAxT t3nj6r2xcwfozQzpoZnSjvcLSDj+7weGws3BESGRtuvkfl+Vwcr2VCjX9mLPwIAxzM1Y TzlVNPz7p4jCJeDDfR//iyqjw+IGCUSTKInq03PnJW2CV/l7+lLzzOOqUfC/t1O/+TK8 cUuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=aRSf+xLI; 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 i6si1894927edn.424.2020.07.23.16.43.45; Thu, 23 Jul 2020 16:44:07 -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=aRSf+xLI; 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 S1728044AbgGWXn3 (ORCPT + 99 others); Thu, 23 Jul 2020 19:43:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgGWXn3 (ORCPT ); Thu, 23 Jul 2020 19:43:29 -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 CD722C0619D3 for ; Thu, 23 Jul 2020 16:43:28 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id 140so4238838lfi.5 for ; Thu, 23 Jul 2020 16:43:28 -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=7V/kDihgL5kEC4lQSCSY3jEHwZPrFwJNpyNc4Cr/ySQ=; b=aRSf+xLIu4Y/vCn7qDLq71u/ubEYET8Rf4RKodJV13afaOPSHdMUSqkPmn9t0HVwrD b4wqq0HG80AjQARZNArZLDzkQpxmeI2nVK1+/b/fc5R8U2JxvxJDLdt4W49tv/+3UpZw fpPPhpjyMb262XAMeCKI2kb7aMfTCpQiOhQs4= 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=7V/kDihgL5kEC4lQSCSY3jEHwZPrFwJNpyNc4Cr/ySQ=; b=GyHDyeuM9AZFAqxYxA6Y7hi8YEQPaxiYcX7Q5UqWm5RTUa1GIlnvKCFjg5Pcl4rUBy 3fCsz9sGCP/lBRCoFPnBLWmg5cMAvO5U0e3D6CnBOmcLfSkZfqcAUB7b3JBgueUTxXw4 FxrbWdz7l7CaZSzCypO6yq4SSXeYB7baKhlGR2j4c3owVPeBroqTwK7bVnfR4Kqck/Sh AXG2emgDyBcTzF9K9nbrBxwycUhsL+3q/IlJBD01s50MZjQe76zRUsAD/d6KtMZTHi3k K7WNiOyFQdI+ajDRDgTV/QWKuyht1bAFL7wfe4kaPC8hV6VenNQN5/6QJSSMlf9Nex/1 ugKw== X-Gm-Message-State: AOAM532wisHUbQfQjSaj2jHvBDwCETVtrGFw6eIChrFLEtqDQ4YfjdTi XRIiG+I810jjQDRPeSssx7gr6+2fuMo= X-Received: by 2002:a19:e009:: with SMTP id x9mr3551861lfg.11.1595547806944; Thu, 23 Jul 2020 16:43:26 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id u5sm3526671lfm.81.2020.07.23.16.43.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jul 2020 16:43:25 -0700 (PDT) Received: by mail-lj1-f171.google.com with SMTP id h19so8141439ljg.13 for ; Thu, 23 Jul 2020 16:43:25 -0700 (PDT) X-Received: by 2002:a2e:999a:: with SMTP id w26mr2920466lji.371.1595547805242; Thu, 23 Jul 2020 16:43:25 -0700 (PDT) MIME-Version: 1.0 References: <20200721063258.17140-1-mhocko@kernel.org> <20200723124749.GA7428@redhat.com> In-Reply-To: From: Linus Torvalds Date: Thu, 23 Jul 2020 16:43:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] mm: silence soft lockups from unlock_page To: Hugh Dickins Cc: Oleg Nesterov , Michal Hocko , Linux-MM , LKML , Andrew Morton , Tim Chen , Michal Hocko Content-Type: multipart/mixed; boundary="00000000000027ca3205ab246ca4" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000027ca3205ab246ca4 Content-Type: text/plain; charset="UTF-8" On Thu, Jul 23, 2020 at 4:11 PM Hugh Dickins wrote: > > On Thu, 23 Jul 2020, Linus Torvalds wrote: > > > > I'll send a new version after I actually test it. > > I'll give it a try when you're happy with it. Ok, what I described is what I've been running for a while now. But I don't put much stress on my system with my normal workload, so.. > I did try yesterday's > with my swapping loads on home machines (3 of 4 survived 16 hours), > and with some google stresstests on work machines (0 of 10 survived). > > I've not spent long analyzing the crashes, all of them in or below > __wake_up_common() called from __wake_up_locked_key_bookmark(): > sometimes gets to run the curr->func() and crashes on something > inside there (often list_del's lib/list_debug.c:53!), sometimes > cannot get that far. Looks like the wait queue entries on the list > were not entirely safe with that patch. Hmm. The bug Oleg pointed out should be pretty theoretical. But I think the new approach with WQ_FLAG_WOKEN was much better anyway, despite me missing that one spot in the first version of the patch. So here's two patches - the first one does that wake_page_function() conversion, and the second one just does the memory ordering cleanup I mentioned. I don't think the second one shouldn't matter on x86, but who knows. I don't enable list debugging, but I find list corruption surprising. All of _that_ should be inside the page waiqueue lock, the only unlocked part was the "list_empty_careful()" part. But I'll walk over my patch mentally one more time. Here's the current version, anyway. Linus --00000000000027ca3205ab246ca4 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_kczftiv60 RnJvbSBjZjZkYjBiODU1NDcyM2YwMzA4ZmQ5Mjk5ZTY0Mjg5OGUzNmM5YzhjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFRodSwgMjMgSnVsIDIwMjAgMTA6MTY6NDkgLTA3MDAKU3ViamVjdDog W1BBVENIIDEvMl0gbW06IHJld3JpdGUgd2FpdF9vbl9wYWdlX2JpdF9jb21tb24oKSBsb2dpYwoK SXQgdHVybnMgb3V0IHRoYXQgd2FpdF9vbl9wYWdlX2JpdF9jb21tb24oKSBoYWQgc2V2ZXJhbCBw cm9ibGVtcywKcmFuZ2luZyBmcm9tIGp1c3QgdW5mYWlyIGJlaGF2aW9lIGR1ZSB0byByZS1xdWV1 ZWluZyBhdCB0aGUgZW5kIG9mIHRoZQp3YWl0IHF1ZXVlIHdoZW4gcmUtdHJ5aW5nLCBhbmQgYW4g b3V0cmlnaHQgYnVnIHRoYXQgY291bGQgcmVzdWx0IGluCm1pc3NlZCB3YWtldXBzIChidXQgcHJv YmFibHkgbmV2ZXIgaGFwcGVuZWQgaW4gcHJhY3RpY2UpLgoKVGhpcyByZXdyaXRlcyB0aGUgd2hv bGUgbG9naWMgdG8gYXZvaWQgYm90aCBpc3N1ZXMsIGJ5IHNpbXBseSBtb3ZpbmcgdGhlCmxvZ2lj IHRvIGNoZWNrIChhbmQgcG9zc2libHkgdGFrZSkgdGhlIGJpdCBsb2NrIGludG8gdGhlIHdha2V1 cCBwYXRoCmluc3RlYWQuCgpUaGF0IG1ha2VzIGV2ZXJ5dGhpbmcgbXVjaCBtb3JlIHN0cmFpZ2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MQUdfV09LRU4p CiAJCQlicmVhazsKLQkJfQorCisJCWlvX3NjaGVkdWxlKCk7CiAJfQogCiAJZmluaXNoX3dhaXQo cSwgd2FpdCk7CkBAIC0xMTkwLDcgKzEyMTUsNyBAQCBzdGF0aWMgaW5saW5lIGludCB3YWl0X29u X3BhZ2VfYml0X2NvbW1vbih3YWl0X3F1ZXVlX2hlYWRfdCAqcSwKIAkgKiBib3RoZXIgd2l0aCBz aWduYWxzIGVpdGhlci4KIAkgKi8KIAotCXJldHVybiByZXQ7CisJcmV0dXJuIHdhaXQtPmZsYWdz ICYgV1FfRkxBR19XT0tFTiA/IDAgOiAtRUlOVFI7CiB9CiAKIHZvaWQgd2FpdF9vbl9wYWdlX2Jp dChzdHJ1Y3QgcGFnZSAqcGFnZSwgaW50IGJpdF9ucikKLS0gCjIuMjguMC5yYzAuMy5nMWUyNWQz YTYyZgoK --00000000000027ca3205ab246ca4 Content-Type: text/x-patch; charset="US-ASCII"; name="0002-list-add-list_del_init_careful-to-go-with-list_empty.patch" Content-Disposition: attachment; filename="0002-list-add-list_del_init_careful-to-go-with-list_empty.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kczftmke1 RnJvbSBkZGMwMGFhZjhlMDIwYmFiNjMwZWM2NDFiMzc1NjQ2MzQ0NTQ2MzRjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMaW51cyBUb3J2YWxkcyA8dG9ydmFsZHNAbGludXgtZm91bmRh dGlvbi5vcmc+CkRhdGU6IFRodSwgMjMgSnVsIDIwMjAgMTI6MzM6NDEgLTA3MDAKU3ViamVjdDog W1BBVENIIDIvMl0gbGlzdDogYWRkICJsaXN0X2RlbF9pbml0X2NhcmVmdWwoKSIgdG8gZ28gd2l0 aAogImxpc3RfZW1wdHlfY2FyZWZ1bCgpIgoKVGhhdCBnaXZlcyB1cyBvcmRlcmluZyBndWFyYW50 ZWVzIGFyb3VuZCB0aGUgcGFpci4KClNpZ25lZC1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