linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	xcf@ustc.edu.cn
Subject: Re: [RFC][PATCH] vfs: check inode size on no_cached_page
Date: Tue, 14 Apr 2009 17:11:14 -0700	[thread overview]
Message-ID: <20090414171114.04a47932.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090412071605.GA14058@localhost>

On Sun, 12 Apr 2009 15:16:05 +0800
Wu Fengguang <fengguang.wu@intel.com> wrote:

> [This patch may not necessarily be merged, but at least we should
>  be aware of the problem.]
> 
> When user space requests past-EOF data, do_generic_file_read() will
> issue a bonus readpage call, which may be unfavorable.
> 
> do_generic_file_read:
>         -> find_page:
>         -> find_get_page()             = NULL
>         -> page_cache_sync_readahead()
>         -> find_get_page()             = NULL
>         -> no_cached_page:
>         -> readpage:
>                 -> nfs_readpage()      = error
>         -> readpage_error:
> 
> Reported-by: Xu Chenfeng <xcf@ustc.edu.cn>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  mm/filemap.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> --- mm.orig/mm/filemap.c
> +++ mm/mm/filemap.c
> @@ -1269,6 +1269,11 @@ readpage_error:
>  		goto out;
>  
>  no_cached_page:
> +		isize = i_size_read(inode);
> +		end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
> +		if (unlikely(!isize || index > end_index))
> +			goto out;
> +
>  		/*
>  		 * Ok, it wasn't cached, so we need to create a new
>  		 * page..

Is this a problem which needs to be solved?  userspace does something
silly and the kernel behaves a bit suboptimally?

If thats the only problem here then it's not worth adding fastpath
cycles to fix it?



  reply	other threads:[~2009-04-15  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12  7:16 [RFC][PATCH] vfs: check inode size on no_cached_page Wu Fengguang
2009-04-15  0:11 ` Andrew Morton [this message]
     [not found]   ` <20090415012027.GA4731@ThinkPad>
2009-04-15  1:22     ` Chenfeng Xu
2009-04-15  1:22     ` Chenfeng Xu
     [not found]   ` <20090414171114.04a47932.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-04-15  1:36     ` Wu Fengguang
2009-04-15  2:39       ` Wu Fengguang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090414171114.04a47932.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xcf@ustc.edu.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).