Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4963089pxj; Tue, 22 Jun 2021 11:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1Iz1wB6hQA+r/Xu7Fen1JiKq5rQPCC2j2haNbbNMmhhYYtEToSrnbzn/XB/Fqjg57G6nL X-Received: by 2002:a05:6e02:13a1:: with SMTP id h1mr64687ilo.199.1624387944467; Tue, 22 Jun 2021 11:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624387944; cv=none; d=google.com; s=arc-20160816; b=meRMKXYq/X0T0INKpDWYyG65YJh4w/9e8xit6XS3f0Kt0jtwx3qXgMYP3m8mID5qYg S2NwXqP5oI36r/6+DmwBR9dudCOlrIr2J0noLfBaUO+mScVuw4sGn4yCl7Slh9GHhQft KiEgBIGv2ingtKRurjepuvp5rIjpeLWBpvrI7tBHuXfLQNSdY2OFeK2/KjLLRbJJUyQF HQCfimb6Q8rDLCY5VUPJXf4VshsPp4mCqQBu76o9JJKw65r6idq1WjGYzKRwgiDitud1 6sNI4QNf6k7Wv1wfL8s6gH8R9JIyb15nYkQmnF4/Zx0auCFFajpbXYEtr1FrjPiXozoF lHpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=4/MYlg+l4edMbeWoa4sr+R1MP+N7EcYv7KKX/Y2Zq/Y=; b=Dob7fwNi1TdgFvtyWTdBxMwKC6HDvf5hzzm3LtEyjQApRokxKs7Z5QHRoCX19u3gvD aCHHx72LmsHQejrLNv02AUfiyOOp8P1D+1jN8H0MnEobpH+U5neBsKkymMMM7wgSCE1r 76XLKwPLobhtGHX70ZUF0gIwbVJeVDI452k2DvJmktC3xqFUoGt/5oYwz4Kfdk/64ffZ YgHaKkmFWg+jOiO8rrkf2SBdMxuq4gpZOsNvi1Ha1jgdBymITOCSFrHa57Lr1uaJa9xk /PA8Js8YiXfBs1TnowtsTPbnLeLZB7xZJXL+9aI6n4gVI86NmA+WGBY+oqhNzKeQQmRQ GYmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V4Dv3CHj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si18756402ilu.13.2021.06.22.11.52.08; Tue, 22 Jun 2021 11:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@gmail.com header.s=20161025 header.b=V4Dv3CHj; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbhFVSyM (ORCPT + 99 others); Tue, 22 Jun 2021 14:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbhFVSyM (ORCPT ); Tue, 22 Jun 2021 14:54:12 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4814BC061574; Tue, 22 Jun 2021 11:51:55 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id i6so307575pfq.1; Tue, 22 Jun 2021 11:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4/MYlg+l4edMbeWoa4sr+R1MP+N7EcYv7KKX/Y2Zq/Y=; b=V4Dv3CHjaIpXBIzzgxJcZhshdF5aEDawH75NxknuNpKPaRAURqRMeGksBg6oD1k6kb b7OC2dOvp5+n7306HX+apLfiARUZkWC8IKNcpUhgpAlysxSVdmPi16BcobOJWr9i6pKp X44uJu7ULUsWU1/Fnfnp7Z06pfmB+oDUOttQYyl3Otdk93YJQ2sS8y37zZ252+Y5PNRw AzyhKVn7VmFm+VudptO/38iiYIDQgUX9v844zWxDj+hS+me0OxoOtaeFxLjAaovlkkb9 PZ4Q/7pE/DOfLA3fXxpfEMjYhxYpenPP9duHxJQ9Od7OW9Y8uOAPNOqVaBE8qi6AYt2U dY/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4/MYlg+l4edMbeWoa4sr+R1MP+N7EcYv7KKX/Y2Zq/Y=; b=GZdh9coUEaZzwxyF926lxyec6gMURxCSvpMorxKPGeqEhR34krs1CEYqqtuVQ1T/n6 TQWNqthHpVro2SeHFrI83dT2e/2sfx4cYmvC+k12OA1HeU8V/+EVuWw0BEdfT1rdsiSy 8kOeMZ1jLsPUeZnXnlqKOzHXzVMW4AF+jVDcsIFJMew3fJrMlg9QTZAt/NkNiiXhBdmC BHCanaN9uxIPZjXxCUrqaDm204ZQQvNeoYfWRYb6YMahfOtTX6F3Y9bqkTJyP20mHMfO WqtAmurWqzpJxOQyPb9H1t5H4OjFzUdjub7M2Cdw2IC9ykEITF8AnwNjHzwAfdVTjTOe y2WA== X-Gm-Message-State: AOAM530KelTDMgDh2b3fAFqSTpdNukHD29/RcutVNWWl4gsfkwXqdl3R 7GahjR1A76bgOPKAbimegeM= X-Received: by 2002:a62:7e4e:0:b029:303:d6c:f967 with SMTP id z75-20020a627e4e0000b02903030d6cf967mr4996535pfc.59.1624387914467; Tue, 22 Jun 2021 11:51:54 -0700 (PDT) Received: from smtpclient.apple (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id d16sm3072212pjs.33.2021.06.22.11.51.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jun 2021 11:51:53 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: Do we need to unrevert "fs: do not prefault sys_write() user buffer pages"? From: Nadav Amit In-Reply-To: Date: Tue, 22 Jun 2021 11:51:51 -0700 Cc: Linus Torvalds , David Howells , Al Viro , Ted Ts'o , Dave Hansen , Andrew Morton , Linux-MM , Ext4 Developers List , linux-fsdevel , Linux Kernel Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: References: <3221175.1624375240@warthog.procyon.org.uk> <3231150.1624384533@warthog.procyon.org.uk> To: Matthew Wilcox X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org > On Jun 22, 2021, at 11:36 AM, Matthew Wilcox = wrote: >=20 > On Tue, Jun 22, 2021 at 11:28:30AM -0700, Linus Torvalds wrote: >> On Tue, Jun 22, 2021 at 11:23 AM Matthew Wilcox = wrote: >>>=20 >>> It wouldn't be _that_ bad necessarily. filemap_fault: >>=20 >> It's not actually the mm code that is the biggest problem. We >> obviously already have readahead support. >>=20 >> It's the *fault* side. >>=20 >> In particular, since the fault would return without actually filling >> in the page table entry (because the page isn't ready yet, and you >> cannot expose it to other threads!), you also have to jump over the >> instruction that caused this all. >=20 > Oh, I was assuming that it'd be a function call like > get_user_pages_fast(), not an instruction that was specially marked to > be jumped over. Gag reflex diminishing now? Just reminding the alternative (in the RFC that I mentioned before): a vDSO exception table entry for a memory accessing function in the vDSO. It then behaves as a sort of MADV_WILLNEED for the faulting page if an exception is triggered. Unlike MADV_WILLNEED it maps the page if no IO is needed. It can return through a register whether the page was present or not. I once implemented (another) alternative, in which the ELF had a section with an exception-table (holding all the =E2=80=9CAsync-#PF=E2=80=9D = instructions), which described where to skip to if a #PF occurs, but this solution seemed too heavy-weight/intrusive.