Skip to contentSkip to conversation

readahead: remove redundant test in shrink_readahead_size_eio()

PATCH In review Wu Fengguang 1 participant 2 messages Apr 14, 2009 – Apr 15, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 readahead: remove redundant test in shrink_readahead_size_eio()

---
 mm/filemap.c |    3 ---
 1 file changed, 3 deletions(-)
mm/filemap.c +0 -3
@@ -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;
 }
 
#2 lore raw
In reply to a message not in the archive
Quoted 20 lines · Joe Perches
Quoted 8 lines · Wu Fengguang
---
 mm/filemap.c |    3 ---
 1 file changed, 3 deletions(-)

mm/filemap.c EXPORT_SYMBOL(grab_cache_page_nowait); · line 1076

Quoted 8 lines
mm/filemap.c +0 -3
@@ -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.

Quoted 2 lines

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