Re: [PATCH] readahead: remove redundant test inshrink_readahead_size_eio()

From: Wu Fengguang
Date: Tue Apr 14 2009 - 20:32:21 EST


On Wed, Apr 15, 2009 at 12:20:33AM +0800, Joe Perches wrote:
> On Tue, 2009-04-14 at 09:37 +0800, Wu Fengguang wrote:
> > Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
> > ---
> > mm/filemap.c | 3 ---
> > 1 file changed, 3 deletions(-)
> >
> > --- mm.orig/mm/filemap.c
> > +++ mm/mm/filemap.c
> > @@ -1072,9 +1072,6 @@ EXPORT_SYMBOL(grab_cache_page_nowait);
> > static void shrink_readahead_size_eio(struct file *filp,
> > struct file_ra_state *ra)
> > {
> > - if (!ra->ra_pages)
> > - return;
> > -
> > ra->ra_pages /= 4;
> > }
>
> I'm not sure this is redundant.
>
> Perhaps it was seen as an optimization
> given the expense of division.

Nope. It was mainly a way to avoid extra warning messages.
There used to be a printk() between the testing and division.

The division shall be optimized by gcc into a bit shift op.
Anyway this is a very cold execution path, so code size is
much more relevant than its efficiency.

Thanks,
Fengguang

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/