Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71046C433F5 for ; Fri, 3 Dec 2021 18:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382690AbhLCS3D (ORCPT ); Fri, 3 Dec 2021 13:29:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbhLCS3C (ORCPT ); Fri, 3 Dec 2021 13:29:02 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE168C061353 for ; Fri, 3 Dec 2021 10:25:37 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id w1so15031938edc.6 for ; Fri, 03 Dec 2021 10:25:37 -0800 (PST) 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=Or/JmgPTS79GqZIutDkpHnEjHVYD0LU+lzufkfg0YQw=; b=WTkKNkRE6R418ysyxmvF8zDurfo/zAOdLc0UOp7eCzeFJefSW8HET1IAYuo+Taimiy p4iweJpk9xplCCWJEpzAorhhQJWPSFavF78h6ld1rIUuOva5uei/OUOvEgUzYiVZm1wt QpKnqVIUdp4omi7wXkYSNGbpjyco2jCVtE1Lw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Or/JmgPTS79GqZIutDkpHnEjHVYD0LU+lzufkfg0YQw=; b=41KgwsTn+lNFUdOTEq64Tji6nOv8CtaNBX7cuIoY1zcJNnQFIOqlcYK4uky34YLmVH Eh2u3uY0pQudjqwA4UhvR/ncz999hpkVf0EFFyICxTWWRcgekwmS195rlMxShXh6fNQV Gb+e77HZFHeX0uo3J9NSlVnd7/TZM7WP9e5pS6yR756Vi5m8WzyaWTNJYZ2kZGNAL2vI urgD0PCrvvkHZjaWeHQr0fOghPeCk1kA4pyeoGa+nDCUyE39P0Fsq4+rRPlRLOfz1wu0 aZJx4Mj9RBUpQ1VSdj/dWiAUjfoBWfTlcWJXsLb8gk1pCfnGj0dV4+mifiTB2I2Ol0t2 x+/w== X-Gm-Message-State: AOAM531fqZgyKgg03zoOYfCHrjW6/HwWotFgWZLJmCMRx6Xul9EZ3qHX PpgZG2dCdzefqCxI1UebnsCa5t2Zghfqf8kB X-Google-Smtp-Source: ABdhPJxTF87C39kEyL4hVwIbR62oDNKdwCLqZe0CEDIyBiw3K3M5ffp4pUwpfCL+Om1/jNQrXaa4rQ== X-Received: by 2002:a05:6402:4389:: with SMTP id o9mr28916141edc.138.1638555936176; Fri, 03 Dec 2021 10:25:36 -0800 (PST) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com. [209.85.221.53]) by smtp.gmail.com with ESMTPSA id x22sm2322609ejc.97.2021.12.03.10.25.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Dec 2021 10:25:34 -0800 (PST) Received: by mail-wr1-f53.google.com with SMTP id u1so7410171wru.13 for ; Fri, 03 Dec 2021 10:25:33 -0800 (PST) X-Received: by 2002:adf:f8c3:: with SMTP id f3mr23456435wrq.495.1638555933321; Fri, 03 Dec 2021 10:25:33 -0800 (PST) MIME-Version: 1.0 References: <20211201193750.2097885-1-catalin.marinas@arm.com> In-Reply-To: From: Linus Torvalds Date: Fri, 3 Dec 2021 10:25:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/4] Avoid live-lock in fault-in+uaccess loops with sub-page faults To: Andreas Gruenbacher Cc: Catalin Marinas , Josef Bacik , David Sterba , Al Viro , Andrew Morton , Will Deacon , Matthew Wilcox , linux-fsdevel , LKML , Linux ARM , linux-btrfs Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 3, 2021 at 10:12 AM Andreas Gruenbacher wrote: > > It happens when you mmap a file and write the mmapped region to > another file, for example. Do you actually have such loads? Nobody should use mmap() for single-access file copy purposes. It's slower than just doing the copy exactly due to page fault overhead. In other words, you seem to be worrying about the performance of a load that is _explicitly_ badly written. You should be fixing the application, not making the kernel do stupid things. Also, it's worth noting that that situation should be caught by the page-in code, which will map multiple pages in one go (do_fault_around() - for when the pages are cached), and do the readahead logic (filemap_fault() - for when the pages aren't in the page cache). Both of which are a lot more important than the "synchronously fault in pages one at a time". Linus