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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A9F1FC11F67 for ; Fri, 2 Jul 2021 01:14:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A47D61352 for ; Fri, 2 Jul 2021 01:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234592AbhGBBRP (ORCPT ); Thu, 1 Jul 2021 21:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbhGBBRO (ORCPT ); Thu, 1 Jul 2021 21:17:14 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B6B5C061762 for ; Thu, 1 Jul 2021 18:14:43 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id g3so8286175ilj.7 for ; Thu, 01 Jul 2021 18:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F6q+d+OSdqVyGZpPkY0K+9RZhaSmWq15QL3d6lDBiig=; b=b4KSksceqlL1Ymhgf0eJbzBnqOuotNfgFAu60oXn/fwfIxcnppIFg8t3yrMUtgEqFh OMfan0zuHGaK9PJ1iXGxdrD3nLRQMnUe2eX4l+KIMUzoZvvfHq7rSr61P0lEHo9cQl3f EvvU8LsGd17/dhrDgNFu+3fLVyZw6DYKYSLtT1tqh2w1M520AHNAvRTVxwjkdsaOoYha E8LAD31fv4mi+6696D5JpuiDUU3uQe7XNutds3Z6jzbS0ovXSVTEl2qW4U/mCnS+/gJF BDCeTucAoD57zGJkiLMXX3W+IpDE++EqD96ZdVst/RTCkFZnQ38bSBioNE+iS2pURPl9 Pf1Q== 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=F6q+d+OSdqVyGZpPkY0K+9RZhaSmWq15QL3d6lDBiig=; b=LGwuQ998vZA2yYt8uFipCpHAiznlzAPHraPG6mGOUukKY1d6wvGyrTkM+xX2JbPD5q ya3D4WutKyB52UlNoe44Cap5mpNcezu2qmm9ssSADSgnlmqpOjFXwVyMVJTTHOb3RIJx /RE9zba9e7aRHWPVk5My7sloO6m3YXCqMiyd15IJQ06CSwwLI0uvwjNG6bWQsbc9CTzv dy/mJvPk5UofOkSfIAI1d/g+RvZwJkATjcQYTzDMeAZg0QiWUnza2I8la1HvrpMXrRcc 4Ol1IVNX1kmYK+fe/5tZO3Dut0J4VSJhstrx9wZ44vIrbW93YrOF3HtBy8TSyEIJoTbq xQkA== X-Gm-Message-State: AOAM531azUPSReuy6FZTxkS1pUM15yAvEYTPPt4qkK6m003LtkATo6kK 9Yl2AM/aXHDfBM2RL8Vs/GqqZOwGWXczGgwIeww= X-Google-Smtp-Source: ABdhPJzQhUbJyF6fb4MyLJXFciJ/bK6uVcSFO+VlanZegVoqHJwCr06KFd8Eyk7mp511eLN2XQw5mT5d+oflu8gtN/c= X-Received: by 2002:a05:6e02:114e:: with SMTP id o14mr1543607ill.201.1625188481988; Thu, 01 Jul 2021 18:14:41 -0700 (PDT) MIME-Version: 1.0 References: <20210701204246.2037142-1-agruenba@redhat.com> In-Reply-To: From: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= Date: Fri, 2 Jul 2021 03:14:30 +0200 Message-ID: Subject: Re: [PATCH] gfs2: Fix mmap + page fault deadlocks To: Linus Torvalds Cc: Andreas Gruenbacher , 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 Am Fr., 2. Juli 2021 um 02:48 Uhr schrieb Linus Torvalds : > On Thu, Jul 1, 2021 at 5:30 PM Linus Torvalds wrote: > > Of course, if you ask for more data than the file has, that's another > > thing, but who really does that with direct-IO? And if they do, why > > should we care about their silly behavior? > > Now, if the issue is that people do IO for bigger areas than you have > memory for, then I think that's a chunking issue. I don't think the > ITER_IOVEC necessarily needs to be converted to an ITER_BVEC in one > single go. That would indeed be painful if somebody tries to do some > huge direct-IO when they just don't have the memory for it. > > But the fact is, direct-IO has been an incredible pain-point for > decades, because it's (a) unusual, (b) buggy and (c) has very little > overall design and common code. > > The three issues are likely intimately tied together. > > The iomap code at least has tried to make for much more common code, > but I really think some direct-IO people should seriously reconsider > how they are doing things when there are fundamental deadlocks in the > design. > > And I do think that a ITER_IOVEC -> ITER_BVEC conversion function > might be a really really good idea to solve this problem. I've tried to explain above how keeping the user-space pages referenced will just lead to different kinds of deadlocks. That is the problem with this approach. > There's even > a very natural chunking algorithm: try to do as much as possible with > get_user_pages_fast() - so that if you already *have* the memory, you > can do the full IO (or at least a big part of it). > > And if get_user_pages_fast() only gives you a small area - or nothing > at all - you chunk it down aggressively, and realize that "oh, doing > direct-IO when user space is paged out might not be the most optimal > case". > > Linus Thanks, Andreas From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Grünbacher Date: Fri, 2 Jul 2021 03:14:30 +0200 Subject: [Cluster-devel] [PATCH] gfs2: Fix mmap + page fault deadlocks In-Reply-To: References: <20210701204246.2037142-1-agruenba@redhat.com> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Am Fr., 2. Juli 2021 um 02:48 Uhr schrieb Linus Torvalds : > On Thu, Jul 1, 2021 at 5:30 PM Linus Torvalds wrote: > > Of course, if you ask for more data than the file has, that's another > > thing, but who really does that with direct-IO? And if they do, why > > should we care about their silly behavior? > > Now, if the issue is that people do IO for bigger areas than you have > memory for, then I think that's a chunking issue. I don't think the > ITER_IOVEC necessarily needs to be converted to an ITER_BVEC in one > single go. That would indeed be painful if somebody tries to do some > huge direct-IO when they just don't have the memory for it. > > But the fact is, direct-IO has been an incredible pain-point for > decades, because it's (a) unusual, (b) buggy and (c) has very little > overall design and common code. > > The three issues are likely intimately tied together. > > The iomap code at least has tried to make for much more common code, > but I really think some direct-IO people should seriously reconsider > how they are doing things when there are fundamental deadlocks in the > design. > > And I do think that a ITER_IOVEC -> ITER_BVEC conversion function > might be a really really good idea to solve this problem. I've tried to explain above how keeping the user-space pages referenced will just lead to different kinds of deadlocks. That is the problem with this approach. > There's even > a very natural chunking algorithm: try to do as much as possible with > get_user_pages_fast() - so that if you already *have* the memory, you > can do the full IO (or at least a big part of it). > > And if get_user_pages_fast() only gives you a small area - or nothing > at all - you chunk it down aggressively, and realize that "oh, doing > direct-IO when user space is paged out might not be the most optimal > case". > > Linus Thanks, Andreas