Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1733177pxp; Mon, 7 Mar 2022 00:54:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeA5avJDknujL46jvKCFE2b38bR8InmNiQW3W4et1Zz/OGyrGarmQjJ0w0c0r5f+VtTorI X-Received: by 2002:a05:6402:f07:b0:415:ce36:d414 with SMTP id i7-20020a0564020f0700b00415ce36d414mr9907283eda.233.1646643273504; Mon, 07 Mar 2022 00:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646643273; cv=none; d=google.com; s=arc-20160816; b=rnKeL2XCTxCyTsFt7SugYxW1kSeBIM5wxLOTClOYZkLVXNOYP0IjFUsug87zAwOsKE JLbOpZQtjNuCmpR9Gt4ZY8WMtNjxuooopbx15Z6RW3zuN8pspC3R7i5HOLO8JWIP5BFd y+i0XhedJcL2+E4wO1N4e1aLv9y1IQd0I8hll5M3aTp7q/gblGusuR7bbBlaGAjz8+aX fbnr/CKtANQwhSQNwQ2ZfpmGEWLRShNnxDPJYWBmS0F0ioNL7HMaHV65T7I6kZoePlY7 kHS7yohbt+Hhjx1ikGgJUFWfthKHJtwd8BCRs21AqK286+5nQ+DMCZk2E48TzPOGOyu6 wHNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Dmdy+i3uT1vMTjIIUUGxY356tL80CQPC7DAppRvN/v4=; b=gKDya/edDjd60GLdgIm3/Y5tiRqXgljhGEXAFCMHFu0MGFCiW/fgSlsCs80Zi9ZEuU phjUBMQGpXwaRTXd+kiSGXHSSt10k4KVVnSIAnn74UAJQlGjwpwiGXqMSKS9ho+3KYf7 lsTKt6i7Da6RhB4l17U6pFug5rFlVf0SkE2u8pqgGD2yQ57DA5dWfGkymVgJ/YN5cLBi DPfSn1Oa6/rCCnTgLsx8TTCJirZFTnMGO+Z4YiHPvMyrc8SPjmgaR48Dm1HTupaJw0Mx sOB9d/visS+R+3QSzGNG8CYxy0aPZo2lqisTCnCwzm2iYOJijdal/MqfqNljtcl9BRXl JPYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RHlAsrw5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9-20020a170906310900b006d123d985a8si7773093ejx.568.2022.03.07.00.54.10; Mon, 07 Mar 2022 00:54:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RHlAsrw5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234409AbiCFW5Z (ORCPT + 99 others); Sun, 6 Mar 2022 17:57:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbiCFW5Y (ORCPT ); Sun, 6 Mar 2022 17:57:24 -0500 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F845D19E for ; Sun, 6 Mar 2022 14:56:30 -0800 (PST) Received: by mail-oi1-x229.google.com with SMTP id w127so3084303oig.10 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=eiQhKnFDFDSWN3qNfFiE6jH99J8YiEIYEK9fpl9dGqaMYuiDZumTtSfiNRgpcRMj/u QUxk1zuqlcyO1Oj2DhCxS2FCRI7FHpnjETRmEORckKcn47oCsAHCXP3Td30YklvQNm2a hwy8JCpICSHqZktXfF7lkuWzMU6EY7UR2ly+z1Ltw3pVIr0m70FNO52UBRN3GBF86139 Dr0iwvGTde1xSSY4lhBjUWB04WsDfpwyizQdZxdIbs+PPaFNOJbLehCt41dHWRkszzqk kBdv++aNKfcG6AHE0ZwWqDC0EZJePOGD7ido8wP9hiHoZ5YINeaXscIlIibQb2KbNtcT 13Zg== X-Gm-Message-State: AOAM530V492AVLRLeCIzFf/UDEjBay3PYwp0IE0yszGOqfGm7sjlxVGn KGgLDNwMaPOfhRVgUtBa5BvMrA== 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-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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