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 E8BAFC48BE5 for ; Tue, 22 Jun 2021 18:51:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A8E961075 for ; Tue, 22 Jun 2021 18:51:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A8E961075 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 594086B005D; Tue, 22 Jun 2021 14:51:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5443A6B006C; Tue, 22 Jun 2021 14:51:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3975C6B006E; Tue, 22 Jun 2021 14:51:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0251.hostedemail.com [216.40.44.251]) by kanga.kvack.org (Postfix) with ESMTP id 028AD6B005D for ; Tue, 22 Jun 2021 14:51:55 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2BB1F181A8427 for ; Tue, 22 Jun 2021 18:51:56 +0000 (UTC) X-FDA: 78282254232.29.36F27A4 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf18.hostedemail.com (Postfix) with ESMTP id D203F20015DE for ; Tue, 22 Jun 2021 18:51:55 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id e22so11666563pgv.10 for ; 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=oH5N3kjYO/9gwxy+S6g+/qVhUzU7KeA3/tnj1FFKMKhvdTXhb7ZOQB/QXjnQEWuSRN wOE4coE6d3sIqCrs74qxpAkZZn5+FB5RVfa/lOf6MqxUXW14nAUQAsdBlVuLZ7PqWNaJ eHi4vKpcy7zWYcau56s7DLrt+E+N3WzpbPzbSvw6XycnLOYJbJGfEGJkZUzieexkOIc6 PWvt223v6+gZD+QTUzdflNs5ctrUQW5BUuRu5hoXJV4fuw1FsrC/rbpA88lDbZINhkE1 mriah+CJMgczzXIsHnHtPoIzDnKV8O0Q0OzTpZ5oKid+tvVmCH7hq3zE5LPlDav0T1eM 2Ymw== X-Gm-Message-State: AOAM5337Rm5Ic0nRx6dPrtP99aRpAppEcAYF0EtvMUyz5z3RpfkFoCx6 L90LBCvbfd21gfGyRoKw8YU= X-Google-Smtp-Source: ABdhPJy9RPE96Mf4U/NtaPJQ5KDQ3f+Gd6S2Yeqz1pf+kN2172xJUtOQFw9yDBippgHQQgmh/RcZHA== 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) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=V4Dv3CHj; spf=pass (imf18.hostedemail.com: domain of nadavamit@gmail.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=nadavamit@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D203F20015DE X-Stat-Signature: 3myxmjsz93u94thmetg4g3qkzsyuxieo X-HE-Tag: 1624387915-665553 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > 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.