Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp520780ybx; Wed, 30 Oct 2019 00:05:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMHdE3A/fdH/8ipQ5jd9Yo37Nol9Qf/ZUX2L6pZakaa7fhybwoQUKUw6kko0JPX2e5GZgz X-Received: by 2002:a17:906:22c8:: with SMTP id q8mr7302555eja.19.1572419156688; Wed, 30 Oct 2019 00:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572419156; cv=none; d=google.com; s=arc-20160816; b=I6ZJ1QWsUusD8/U3skj0BNN1DQnyS4/ArFDbmnVuiULGEwBPt5+7/09DLUjpWWHovf h0PIXtNZyvXyB0tOrvl2Dk9JB33M2x8TK6zkrLT9dcCTrOjDSArcsetxPD0YOcs7pcOB MXMptX8HbH2VMEdbYNlAe4vQ2b3dQZd/Zi3If5BcqIaJepwYrjxA/ux0rMD98jccPU8g oSEMCmgm/50QiImWhnrn8sXT2aSICagKiBZDL2IV3hNocgt6G+tatGvXmHr9VvQV8rPz jl8NRRpVexWVWlISsO6Vx2S2f+6Y1T471UzW+E6oA8EMeLVqEu438QrZ0OkSOa69HUKW SR9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JkPxjSTbXJRVlSsGsdM45+hTs410YbmCCQkse72XJ4Y=; b=kV5Ywh97sGj46fHpqMwC3CxAjh0NPN+w6E94FR+lZEKExp+sWnBX1LfkXXOp2Rthb8 3zlI0FL+kwEbEnqERmgCuA7k8GQTc2TkvvxHUt49gFJubrM/6UZ+m5F9S9ltTD089yzS 2o5cSne71io9zim2ETRuPR1chOQTLPYUgEuhfrDN3l8hXuR3sS3yEgBLufd/OTsQKZAc TPiImmakpX0md/224xlAHmNa+Tf/7FpKCp6LFKdiPw9Durjp3Or+IO6eBs1SWRCwhX3M j17syW03Y+sicCeQFH3rS9/96kUvabDqBpo4y5htEvCguXZwr2EFpR4bLkp5ShngxVVh Xb4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EJUY1JQv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19si957211edz.85.2019.10.30.00.05.31; Wed, 30 Oct 2019 00:05:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EJUY1JQv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbfJ3HCg (ORCPT + 99 others); Wed, 30 Oct 2019 03:02:36 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37843 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbfJ3HCg (ORCPT ); Wed, 30 Oct 2019 03:02:36 -0400 Received: by mail-lj1-f195.google.com with SMTP id v2so1389470lji.4 for ; Wed, 30 Oct 2019 00:02:34 -0700 (PDT) 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=JkPxjSTbXJRVlSsGsdM45+hTs410YbmCCQkse72XJ4Y=; b=EJUY1JQv+QdQjb/gEObNMcJ78C0IhEJfrdoWxqU34kB9i8Bg/sWh/y3mgavhGW/PEq vhD7pUJS4U+vzBOM2zuUAC9zkjBi+8tmMTFlpxoi0FPmyW1RXKur3WY5NqokJ0g4R2wy 7TiXXVvHYhvBEsiZolrKl8XydGUo3K1rzh3Yw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JkPxjSTbXJRVlSsGsdM45+hTs410YbmCCQkse72XJ4Y=; b=n+6UKQCTSG7C2kZuwpwAQLsg5KShxiBi/fk8psjlOzhGC9N/+mibKd2ZoydFTw3HTZ 3wk92kh2xpFN0XPBmz7q6Tq+Ux/prF1nVliS7IHj6bFqEYLV91HBYa6BbvNYMtwAOCwn ots+SMdvCA3g3gQ5GPwnYAbGF+Zc5RxGm/JHjSLUNmU96peXVf5y9qYjE8OiuzMsg9g3 5Siic4fgMYsn8yE3ba9/+mD3TJ5MKus8QYSNcBXpTsnrcJi3tAtsZSh2Pbl7Cme66DBJ smR+3JqaSqOAotJlcEtMmRAn13xXyFhBKRJsG6N8bglC1y2VPkY8YV0Z6Q9MJuQ2+maO BK/Q== X-Gm-Message-State: APjAAAXAFSToVqnNeUdICJ5u33oFeaZnOAf0w0aOBoLOMe6P5SxY3yY8 577bSnhwkYeoP8wQO5I9L/pD7+LFPg+bkA== X-Received: by 2002:a2e:9888:: with SMTP id b8mr4840075ljj.167.1572418953692; Wed, 30 Oct 2019 00:02:33 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id p88sm684246ljp.13.2019.10.30.00.02.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Oct 2019 00:02:31 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id q28so688942lfa.5 for ; Wed, 30 Oct 2019 00:02:31 -0700 (PDT) X-Received: by 2002:ac2:5bca:: with SMTP id u10mr5108158lfn.134.1572418950853; Wed, 30 Oct 2019 00:02:30 -0700 (PDT) MIME-Version: 1.0 References: <157225677483.3442.4227193290486305330.stgit@buzz> <20191028124222.ld6u3dhhujfqcn7w@box> <20191028125702.xdfbs7rqhm3wer5t@box> <20191030065037.o3q6usc5vo3woif6@box> In-Reply-To: <20191030065037.o3q6usc5vo3woif6@box> From: Linus Torvalds Date: Wed, 30 Oct 2019 08:02:14 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/filemap: do not allocate cache pages beyond end of file at read To: "Kirill A. Shutemov" Cc: Konstantin Khlebnikov , Linux-MM , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , Alexander Viro , Johannes Weiner , Steven Whitehouse Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 30, 2019 at 7:50 AM Kirill A. Shutemov wrote: > > I don't know much about filesystems, but can't size of file change after > the open() under network filesystem? Revlidation on read looks like an > requirement anyway, no? Requirement? No. But QoS issue, yes. But note that NFS already does that. Look at nfs_file_read(), and notice how it's not using generic_file_buffered_read() directly, it's doing its own thing first with checking for direct-IO, but then doing that nfs_revalidate_mapping() that checks whether caches should be re-validated. It's not just size of the file, the actual cached contents may need invalidating too etc. And note how the generic page cache reader doesn't need to care. If what the generic code does isn't enough, or is the wrong thing, the filesystem simply shouldn't use it, or, like NFS, do its own thing first/last. So I think the "some filesystems may have other rules" is irrelevant. If they do have other rules, it's _their_ issue, not the issue of the generic page cache read logic. Linus