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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D38C433F5 for ; Sun, 6 Mar 2022 22:56:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C3768D0002; Sun, 6 Mar 2022 17:56:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 172F38D0001; Sun, 6 Mar 2022 17:56:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 013348D0002; Sun, 6 Mar 2022 17:56:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id E84338D0001 for ; Sun, 6 Mar 2022 17:56:30 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id BFF6B120774 for ; Sun, 6 Mar 2022 22:56:30 +0000 (UTC) X-FDA: 79215472140.07.BA9FF8C Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by imf13.hostedemail.com (Postfix) with ESMTP id 666C720002 for ; Sun, 6 Mar 2022 22:56:30 +0000 (UTC) Received: by mail-oi1-f180.google.com with SMTP id 12so13470427oix.12 for ; Sun, 06 Mar 2022 14:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Dmdy+i3uT1vMTjIIUUGxY356tL80CQPC7DAppRvN/v4=; b=RHlAsrw54Syc2b71XmoAgc9tMoyxPncID+HTKRbKcPDoK+nb2lLb2KMUJ5oatezqJp kIQQ8j+85C2WVQdSEoPVsTdpnTeNe6L0drMxTDR5fKK4Rwz2TBrpJPh6lga7htOXgfQ1 vDHAHgP9kvM4alxHv9ZA+Tl7hsCTw7YIfzWx/5BPHvGXkG2qQVM08N9oKF00/EW+oXMM VuaZpiO/OTsdaZMjQ10HiMDEaXlnhDwdKoyeJAUq+EhwftYbc+K/9nzQyZXPjd2T4wRQ LDVLSnZzumNt9ZjmCBpyqDDGcuCfBtuh5jU4S6yqquMYTxfKnYDL4OT6gqhQWFFRiRsF O1PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Dmdy+i3uT1vMTjIIUUGxY356tL80CQPC7DAppRvN/v4=; b=XcQeHNJu6RlgPIzqRFz09DGSUx4aSnEwjZATZO8fH99YqS03Zqg0hzDZIqD+j45jcp VOIYQ3DUUCDYeWTvOIIoGj9GmQY5SrraT6aMPdmLrnJ/QgcMWdNPrEZBav3quQ1/AvZ/ pVxTKWlltORBbFicyw4xXI/5zZCzI7jgqlF7bEJ1ZE9vjLtcafe8vD6Iagz+MHL3lZSQ cl8uJk2SDBhz+xoUhtwkPrwxIdHKkxjgi1RKTEIPU/dRC3ejlwCG7D0lgiS4gOPywPLo mknsW3qLcsoCiT/mUaRBpDFjUao2hKCiDGZ4hUwRuXMOWNJeqwevJ+rm189+AlM/VrDj zUXQ== X-Gm-Message-State: AOAM532uszBhC42jiz0+hbj+TLY4Z6uqY4T/+ocdiaPEqJENjmK8DUr4 Vhi0ZBXcCOZYpyqXIsYegHbr+Q== X-Google-Smtp-Source: ABdhPJywLyJhZyD9J9gY8eJAMWK13um1KkbIWUiUudShTIbdvipbiaXew6S5+74+8I/+oUq8A7Ry0g== X-Received: by 2002:a05:6808:1201:b0:2d9:a01a:48b8 with SMTP id a1-20020a056808120100b002d9a01a48b8mr5756240oil.259.1646607389518; Sun, 06 Mar 2022 14:56:29 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id b63-20020acab242000000b002d9ddf4596fsm238029oif.49.2022.03.06.14.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Mar 2022 14:56:28 -0800 (PST) Date: Sun, 6 Mar 2022 14:56:16 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Christoph Hellwig cc: Hugh Dickins , Andrew Morton , Mikulas Patocka , Zdenek Kabelac , Lukas Czerner , "Darrick J. Wong" , Miklos Szeredi , Borislav Petkov , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH mmotm] tmpfs: do not allocate pages on read In-Reply-To: <20220306092709.GA22883@lst.de> Message-ID: References: <20220306092709.GA22883@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 666C720002 X-Stat-Signature: zjkwcmgu34tn3k7wjjxxoep541pub45k X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RHlAsrw5; spf=pass (imf13.hostedemail.com: domain of hughd@google.com designates 209.85.167.180 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam07 X-HE-Tag: 1646607390-694713 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 Sun, 6 Mar 2022, Christoph Hellwig wrote: > On Fri, Mar 04, 2022 at 09:09:01PM -0800, Hugh Dickins wrote: > > It's not quite as simple as just removing the test (as Mikulas did): > > xfstests generic/013 hung because splice from tmpfs failed on page not > > up-to-date and page mapping unset. That can be fixed just by marking > > the ZERO_PAGE as Uptodate, which of course it is; doing so here in > > shmem_file_read_iter() is distasteful, but seems to be the best way. > > Shouldn't we set ZERO_PAGE uptodate during early init code as it, uh, > is per definition uptodate all the time? You're right, that does look hacky there. I was too unsure of when and how the different architectures set up ZERO_PAGE, so kept away. But looking through, pagecache_init() seems late enough in initialization and early enough in running, and an appropriate place to do it - tmpfs may be the first to need it, but it could be useful to others. Just on ZERO_PAGE(0), the one used all over: never mind the other colours of zero page, on those architectures which have multiple. v2 coming up. > > > > > My intention, though, was to stop using the ZERO_PAGE here altogether: > > surely iov_iter_zero() is better for this case? Sadly not: it relies > > on clear_user(), and the x86 clear_user() is slower than its copy_user(): > > https://lore.kernel.org/lkml/2f5ca5e4-e250-a41c-11fb-a7f4ebc7e1c9@google.com/ > > Oh, that's sad as just using clear_user would be the right thing to > here. > > > But while we are still using the ZERO_PAGE, let's stop dirtying its > > struct page cacheline with unnecessary get_page() and put_page(). > > > > Reported-by: Mikulas Patocka > > Reported-by: Lukas Czerner > > Signed-off-by: Hugh Dickins > > But except for maybe making sure that ZERO_PAGE is always marked > uptodate this does looks good to me. Thanks a lot for looking through. Hugh