Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1765344ybh; Thu, 23 Jul 2020 17:48:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwciSnMlkdwMvh8vO1Niyjy8qwIr3/drL8NiRJT8nO82TwqpEFObHgdqkhllC+PJnwh1Tv+ X-Received: by 2002:a50:b941:: with SMTP id m59mr6464326ede.321.1595551685136; Thu, 23 Jul 2020 17:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595551685; cv=none; d=google.com; s=arc-20160816; b=thfdX0/rT7+NRnueI/TTVTYSsdfflYFR1e3daRXAwGyTw8PW3Ibeg24v4R8HEvYfeh QkXSnGIHmdV4dVtCivo0CXZFBS0ERASagvCJIFWf7eH9LIhDFYXj90ykrqCV1jUGwiSF 8tJFy7PD8iGR3jHx4gZ+8bTKtAxdrGSvxWQ/otVfnLsZvQlU4REWZFPqmFphfBY/yLlJ x2+1Lg3TiWihncwHwpJ+MWsRo2UHUPNdhLGu97Xr/dxd+Fzn0hZCI+YNhUr4cnLg/2Rt PmAMa6AbYdmm4RktMzJS2w5JUXm2N06ViRWE8VH2eD4ieQb/WKDLfeih48oW01KtNM17 s8IA== 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=mUaZ6oEhaxK6LHHxjQm2OcsjcreLEUTmrsVj8KinfEw=; b=cpQM9QptqYHS7FKLMK7bEg8VyLawdxM++cvtbCOmaM24Jnleqimv6PhHzkD2C3JUcn jqHMDsLhaaBjUoAIAXUihxJbRgfaOFAtCGBQInjlDt4LTF6ekDJK4ceU5DoRy/YVGZJA aj2Tc6a5qvOGe5u97WhSTsFg9rwLdB95CGqxF3Zfbvqne/Q5z0Z2lq1b/eUy4KFxqba9 SyrTZc2fzT67AbcyjJq4UZ4cu9Kx3rlK6Gw51pWKIe3qHKBB3rMhvx4pRZEPD79plb1B L6c9w7b7HhWogl5RapLrWRX58ENglk7aW6ZQfSVZKN3CMGJW7MM4NlqYqPDwy8+oLRPj 2Ohg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=MfMPxvMD; 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 h1si3004294edv.246.2020.07.23.17.47.42; Thu, 23 Jul 2020 17:48:05 -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=MfMPxvMD; 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 S1728433AbgGXArU (ORCPT + 99 others); Thu, 23 Jul 2020 20:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbgGXArT (ORCPT ); Thu, 23 Jul 2020 20:47:19 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEEB2C0619D3 for ; Thu, 23 Jul 2020 17:47:18 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id z24so8270783ljn.8 for ; Thu, 23 Jul 2020 17:47:18 -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=mUaZ6oEhaxK6LHHxjQm2OcsjcreLEUTmrsVj8KinfEw=; b=MfMPxvMDiUBBcl90gFozRhD46ePBTnsGsvmrHjsEBskvGVqG0I3gH9nIf1ESYZxS07 Sl1DHyZskPVvE8LErPPfUDDDcK+05p7FEM34h0GGpTgr217o11tHoE+fl0bCOD0HqzEx RW0W/ERJnL1Dv/2rmNvi0o5hhSw3jqX/7J/oU= 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=mUaZ6oEhaxK6LHHxjQm2OcsjcreLEUTmrsVj8KinfEw=; b=F3IFAHsuTUAgoiKKFoNbFaXiRe150SuC8bHJEEP0njGo1cmu8fN4NBAwQEgEIZ7/Dk +0Tfv/6aP15Gqq4E/E78Y3x7iEAsD2RgitaRaVtRzLtoYlD99/iVkp2pK1K303gnJyKB vyjlSBGS/uEBbe1n+cNpXQYvlPzaXe26sw3yHQiicCOiBME2p+WXg7L8nUbakbZ43Vwl VkMzifmpijwJCcL4FBQIpnbxfcvLSYpmjslws/pdK11AdjbTiLIkRirkX4/+ix9ZKY3t 4E94qNfNJ3gxeyMDg3kUzwi0endRaJ74wsYw4PgSh/qaylzsnf9oNW2yVVds/caUu26V 7GPQ== X-Gm-Message-State: AOAM532ePrpr8RIDh5+lU579j7WOJQccAORTqFt7g4R340gaY+AWEF82 WEGvNNgOX2BxMGnZYWFlFEkllP1tOYg= X-Received: by 2002:a2e:9641:: with SMTP id z1mr3166679ljh.173.1595551636834; Thu, 23 Jul 2020 17:47:16 -0700 (PDT) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id p4sm3630070lfk.0.2020.07.23.17.47.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Jul 2020 17:47:15 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id u12so4297898lff.2 for ; Thu, 23 Jul 2020 17:47:15 -0700 (PDT) X-Received: by 2002:ac2:58d5:: with SMTP id u21mr3512335lfo.31.1595551635182; Thu, 23 Jul 2020 17:47:15 -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 17:46:59 -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: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 5:07 PM Hugh Dickins wrote: > > I say that for full disclosure, so you don't wrack your brains > too much, when it may still turn out to be a screwup on my part. Sounds unlikely. If that patch applied even reasonably closely, I don't see how you'd see a list corruption that wasn't due to the patch. You'd have had to use the wrong spinlock by mistake due to munging it, or something crazy like that. The main list-handling change is (a) open-coding of that finish_wait() (b) slightly different heuristics for removal in the wakeup function where (a) was because my original version of finishing the wait needed to do that return code checking. So a normal "finish_wait()" just does list_del_init(&wait->entry); where-as my open-coded one replaced that with if (!list_empty(&wait->entry)) { list_del(&wait->entry); ret = -EINTR; } and apart from that "set return to -EINTR because nobody woke us up", it also uses just a regular "list_del()" rather than a "list_del_init()". That causes the next/prev field to be poisoned rather than re-initialized. But that second change was because the list entry is on the stack, and we're not touching it any more and are about to return, so I removed the "init" part. Anyway, (a) really looks harmless. Unless the poisoning now triggers some racy debug test that had been hidden by the "init". Hmm. In contrast, (b) means that the likely access patterns of irqs removing the wait entry from the list might be very different from before. The old "autoremove" semantics would only remove the entry from the list when try_to_wake_up() actually woke things up. Now, a successful bit state _always_ removes it, which was kind of the point. But it might cause very different list handling patterns. All the actual list handling looks "obviously safe" because it's protected by the spinlock, though... If you do get oopses with the new patch too, try to send me a copy, and maybe I'll stare at exactly where it happens register contents and go "aah". Linus