Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1014798pxv; Thu, 1 Jul 2021 14:59:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQBMeisj/YeSWd9riDG5xCrrwOIdCF5g5ccBW/jtcToRrRmgqkDpb2aEBMlHMsgY6XPHrn X-Received: by 2002:a17:907:86a8:: with SMTP id qa40mr1993472ejc.385.1625176766303; Thu, 01 Jul 2021 14:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625176766; cv=none; d=google.com; s=arc-20160816; b=p25SdyYTnrjq5sCqAybX8IAIJFe2sqEMMjrmaR6Qyc+PkL1db1atLBXGHS0xYPHKu0 NFvwuDakw3GXLvKcImjIAF4YCIfy1q1rbUFq9XxRSrK3qMkMYzcbNiK1b4VU6Rpi9Gwe emD0ZF2sljaM3f01w3jIjL4upj8w9JHXe9ftAueZ2cG2kO8AnUIeItqu61N+2du0dGud WqxMzlD/lAIgVwCjSqyXrk7sJ22qgfyZf96ooZUOoBvTc1lVxcI6K2ICcUpRRpXW17ZR 0sgfhj6+nU26g8rS2rL/JRw9POdc1twFx1OOgMLPBivZGNanDZNcUZ0KXmRg5CTTQP1o T36w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cSLIj5ijLv21MczqPZ//LmnEGNGY+Io9XntuI4cnzoQ=; b=s927tQZv6CLi8AluHZUAPYqF9Mc4TJQeTlVLtU/6bP6KUdT/3iOWDhmzG4jvHXJxDP 5V0AETLXDiSBLusoWr9WzcCqJlXeHg1CG4WCpuw3DNmEW0IlEz9jwavVSLhPEVZ1Dyw0 ZAAmwN7q5CRYAroO5xLsbJN97MHdWHL1+Dp1XmMr+9t3AWzyn252EtGa7nriAx66iWij P4FkT8qwT2loFz6eABvRy/Ub+UyTSFoqWbRu9E65Tg9zTDmWjg0PUr9Ff8A5LYI1bJI+ tu39n9wTg213Y4SPs4az7DFCAe0TgU3mFQKf6247Wbljd30+So+ORLlrlQxuLIQK7lTe yYLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dXQn8I1a; 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 25si1080099ejd.711.2021.07.01.14.59.00; Thu, 01 Jul 2021 14:59:26 -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=dXQn8I1a; 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 S234378AbhGAVoF (ORCPT + 99 others); Thu, 1 Jul 2021 17:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234364AbhGAVoF (ORCPT ); Thu, 1 Jul 2021 17:44:05 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF32C061762 for ; Thu, 1 Jul 2021 14:41:33 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id q18so14390740lfc.7 for ; Thu, 01 Jul 2021 14:41:33 -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=cSLIj5ijLv21MczqPZ//LmnEGNGY+Io9XntuI4cnzoQ=; b=dXQn8I1a2yN1cBmeKPtYWYtIIhKKS/PS4Fir76apBP7PT1Qn1TN9VvXgVyFndwp6Se lPYo3d0jKOsDiTtAmrblfXulaJXTA2jFuhkmV7AM4FfEAhbo135IjiZ8wLGAY9muHzM9 m6GleTnZkrNR86145I3k1RFKMPl59JzpEQKDo= 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=cSLIj5ijLv21MczqPZ//LmnEGNGY+Io9XntuI4cnzoQ=; b=uT/iDSIarLaKg/aF1kQrZsrx3WEJqcAqSjjVo2vv923JiK6jlfVcl6X+od+DsMsH5O quLBDn5rSZUyB5XzgaTkeCXSnc7AY03c0K7qxNtXyxcbeHLevuMwMpkJKRRpBx+yyywg oDefhh7ZB4XpmB9/TrXg4mbWF7dMoHKvdZA1LavuLLYFbqm5JytTu9S4FrVg7v2HF21F SMpnUlre9YzdB5fGzuMHAr+agH/kUkcxABdWTYyjefZN9854JRHHZqanJwe4KRoZGu0v Y7J4YDti7z4QR2a1c6DAanJoQy0Pn0s4raym2OX3jZOnPLvNMDjuMOlabFE6+Emg1IBy o1JA== X-Gm-Message-State: AOAM531xbx4lwenKb5kAfQWVpWR+Q+xxLD5u+1bOOULIeCh5xtc98rj2 SUoaYzdStXSqX7t6m71dcSYvt+66lqkgFgM/rS0= X-Received: by 2002:ac2:533c:: with SMTP id f28mr1311413lfh.268.1625175692079; Thu, 01 Jul 2021 14:41:32 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id x3sm142854ljd.90.2021.07.01.14.41.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Jul 2021 14:41:31 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id e3so2024036ljo.6 for ; Thu, 01 Jul 2021 14:41:31 -0700 (PDT) X-Received: by 2002:a05:651c:32e:: with SMTP id b14mr1183040ljp.251.1625175691224; Thu, 01 Jul 2021 14:41:31 -0700 (PDT) MIME-Version: 1.0 References: <20210701204246.2037142-1-agruenba@redhat.com> In-Reply-To: <20210701204246.2037142-1-agruenba@redhat.com> From: Linus Torvalds Date: Thu, 1 Jul 2021 14:41:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] gfs2: Fix mmap + page fault deadlocks To: Andreas Gruenbacher Cc: Alexander Viro , cluster-devel , Linux Kernel Mailing List , Jan Kara , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 1, 2021 at 1:43 PM Andreas Gruenbacher wrote: > > here's another attempt at fixing the mmap + page fault deadlocks we're > seeing on gfs2. Still not ideal because get_user_pages_fast ignores the > current->pagefault_disabled flag Of course get_user_pages_fast() ignores the pagefault_disabled flag, because it doesn't do any page faults. If you don't want to fall back to the "maybe do IO" case, you should use the FOLL_FAST_ONLY flag - or get_user_pages_fast_only(), which does that itself. > For getting get_user_pages_fast changed to fix this properly, I'd need > help from the memory management folks. I really don't think you need anything at all from the mm people, because we already support that whole "fast only" case. Also, I have to say that I think the direct-IO code is fundamentally mis-designed. Why it is doing the page lookup _during_ the IO is a complete mystery to me. Why wasn't that done ahead of time before the filesystem took the locks it needed? So what the direct-IO code _should_ do is to turn an ITER_IOVEC into a ITER_KVEC by doing the page lookup ahead of time, and none of these issues should even exist, and then the whole pagefault_disabled and/or FOLL_FAST_ONLY would be a complete non-issue. Is there any reason why that isn't what it does (other than historical baggage)? Linus