public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] readahead: remove redundant test in shrink_readahead_size_eio()
@ 2009-04-14  1:37 Wu Fengguang
       [not found] ` <1239726034.32203.129.camel@localhost>
  0 siblings, 1 reply; 2+ messages in thread
From: Wu Fengguang @ 2009-04-14  1:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 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;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] readahead: remove redundant test in shrink_readahead_size_eio()
       [not found] ` <1239726034.32203.129.camel@localhost>
@ 2009-04-15  0:31   ` Wu Fengguang
  0 siblings, 0 replies; 2+ messages in thread
From: Wu Fengguang @ 2009-04-15  0:31 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, LKML

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@intel.com>
> > ---
> >  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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-15  0:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-14  1:37 [PATCH] readahead: remove redundant test in shrink_readahead_size_eio() Wu Fengguang
     [not found] ` <1239726034.32203.129.camel@localhost>
2009-04-15  0:31   ` Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox