[PATCH] scaling of 'max_readahead' in /proc/ide/hda/settings

From: Roger Larsson (roger.larsson@norran.net)
Date: Thu Oct 04 2001 - 14:47:26 EST


I put the note first since it is important:
-----------------------------------------------
NOTE: this scaling problem might be in several drivers and possibly
also in several places in this driver. Most likely in -ac too when
enabling dynamic readahead for SCSI
-----------------------------------------------

In an earlier message I reported that dynamically changing readahead
for ide disk produced unexpected results.

I have now found the reason!

If you did cat the /proc/ide/hda/settings you would have noticed that
max_readahead was zero. But reading the code you would see that
is initialized with MAX_READAHEAD (defined to 31)

I tried to modify this and got strange results when diffing two files bigger
than RAM. Sinusoidal between very good and very poor...
But modifying the MAX_READAHEAD and recompiling worked!

Both of these are due to the same problem with scaling in ide-disk.c

mul_factor = 1
div_factor = 1024

But max_readahead is measured in pages.

When reading the file max_readahead is divided by 1024, resulting
in zero.

A value written to it is on the other hand multiplied by 1024...

So when I tried to set 511 pages readahead (2MB) it was interpreted
as 511*1024 pages (2GB !) So it tried to read ahead all of one file
before trying to read the other (but one file is bigger than my memory)

With the included patch I measure in kB and limit it at 16MB.

/RogerL

-- 
Roger Larsson
Skellefteċ
Sweden


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



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:33 EST