Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4458991ybg; Tue, 29 Oct 2019 07:29:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQWSUO6cH9GrVrPl9akeWF8onY9p92XkVo6qr7WCL0XHfAWQWyt0hN+g80U2eh5dikJbjB X-Received: by 2002:a50:f382:: with SMTP id g2mr13641474edm.240.1572359347170; Tue, 29 Oct 2019 07:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572359347; cv=none; d=google.com; s=arc-20160816; b=JKPYm9B+2FSJ0zcysSvCZGiyzW/OMpYgeBP7LeHh6+19sPXyw+g4Eo+g9Cl89mWB8J sMIvzMNPDD5d1nt5SLsq98LHwSRW1UjOUIqwpSaNyYl/4163lCxHd+ZJGUuZaJZNo4K1 8QVhW9N4gtEpN7ewrsWjcJ+cunSB/tL9grhyRKb5Wjyzu+ming6Z3gqz8+fZlM34WksX Ok8BC0DWOo80MBkL4w94i5qyZND8KoENM93hMiertsiCjlNbcLkxyUVm/48VxuQl2MIF SVTVyuheauiuS7DawV3YAGAE/E4JLSuI2mBQQnAm95WlCtOGY/x5Y4R6Tf6C+VI0S6/D JIGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=kIwUyXR7LgBl9um7BtroesKEgDforbsjtA4cvjy2EaU=; b=H2iwdBPbMapPxhB/QXqTIdjIB0m71JTXGvoSQSx9XbtSANIKyRbxzCrhDy7RZApnt2 nmE61RIy5YR6GKEdd3CxJ9XwcKko3UIdIZF0dvS89HnE7MyF7Dnaih2oUpgvTEyBtI12 6fHqe5fze5ut2ScPP8KfK9rzosB3Z+FRw/gDUsS4Q9UXroX+8XEcP9LQeItEpG+4KuCJ Ln00OxhtM6ND3rUf9mzfmVCBmaitmGHsmD/JhQe0EA4PAbokPUN+JC400Zlsx0wmxEEx g3cmZhQMrr2DbfltlNa4AbYS5p8HG2aq66R5IcHOR0QqziS5Gp0a36ngcVv7jKqQT8mS z6bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=kBbbNspQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qx10si7486481ejb.27.2019.10.29.07.28.43; Tue, 29 Oct 2019 07:29:07 -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=@yandex-team.ru header.s=default header.b=kBbbNspQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389162AbfJ2OZh (ORCPT + 99 others); Tue, 29 Oct 2019 10:25:37 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:42410 "EHLO forwardcorp1p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728306AbfJ2OZh (ORCPT ); Tue, 29 Oct 2019 10:25:37 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id C01D82E1519; Tue, 29 Oct 2019 17:25:33 +0300 (MSK) Received: from iva4-c987840161f8.qloud-c.yandex.net (iva4-c987840161f8.qloud-c.yandex.net [2a02:6b8:c0c:3da5:0:640:c987:8401]) by mxbackcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id k4OaEZrLEs-PW9K6jN5; Tue, 29 Oct 2019 17:25:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1572359133; bh=kIwUyXR7LgBl9um7BtroesKEgDforbsjtA4cvjy2EaU=; h=In-Reply-To:Message-ID:From:Date:References:To:Subject:Cc; b=kBbbNspQ8dCoThI+PybXLSgQ176sm7Z+eKaEXWqy1B0+EU7umkCtVUjkP3zEvwtue T1uqg9AYAwWiNQg9CQIaTBCFw6xNAeWTf2aYVAcqruPn7u8pk9Ezua17H+QLx0YF4W FYg+COEp5VbV26jJ6t1VTi8pJwOaADIjOXLiCnaI= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:148a:8f3:5b61:9f4]) by iva4-c987840161f8.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id iezr0jZMY7-PRWCqN9i; Tue, 29 Oct 2019 17:25:27 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Subject: Re: [PATCH] mm/filemap: do not allocate cache pages beyond end of file at read To: "Kirill A. Shutemov" , Linus Torvalds Cc: Linux-MM , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , Alexander Viro , Johannes Weiner , Steven Whitehouse References: <157225677483.3442.4227193290486305330.stgit@buzz> <20191028124222.ld6u3dhhujfqcn7w@box> <20191028125702.xdfbs7rqhm3wer5t@box> From: Konstantin Khlebnikov Message-ID: Date: Tue, 29 Oct 2019 17:25:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191028125702.xdfbs7rqhm3wer5t@box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/10/2019 15.57, Kirill A. Shutemov wrote: > On Mon, Oct 28, 2019 at 01:47:16PM +0100, Linus Torvalds wrote: >> On Mon, Oct 28, 2019 at 1:42 PM Kirill A. Shutemov wrote: >>> >>> I've tried something of this sort back in 2013: >>> >>> http://lore.kernel.org/r/1377099441-2224-1-git-send-email-kirill.shutemov@linux.intel.com >>> >>> and I've got push back. >>> >>> Apparently, some filesystems may not have valid i_size before >readpage(). >>> Not sure if it's still the case... >> >> Well, I agree that there might be some network filesystem that might >> have inode sizes that are stale, but if that's the case then I don't >> think your previous patch works either. >> >> It too will avoid the readpage() if the read position is beyond i_size. >> >> No? > > Yes. That's the reason the patch was rejected back then. > > My point is that we need to make sure that this patch not break anything. > I think all network filesystems which synchronize metadata lazily should be marked. For example as "SB_VOLATILE". And vfs could handle them specially. For this case generic_file_buffered_read() could call for them readpages for single page (rather than readpage) to let filesystem revalidate metadata and drop unneeded page without inserting it into inode and lru.