Re: [PATCH] mm: readahead: remove redundant ra_pages in file_ra_state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/26/2012 03:36 PM, Fengguang Wu wrote:
On Fri, Oct 26, 2012 at 03:19:57PM +0800, Ni zhan Chen wrote:
On 10/26/2012 03:09 PM, Fengguang Wu wrote:
On Fri, Oct 26, 2012 at 03:03:12PM +0800, Ni zhan Chen wrote:
On 10/26/2012 02:58 PM, Fengguang Wu wrote:
  static void shrink_readahead_size_eio(struct file *filp,
                                         struct file_ra_state *ra)
  {
-       ra->ra_pages /= 4;
+       spin_lock(&filp->f_lock);
+       filp->f_mode |= FMODE_RANDOM;
+       spin_unlock(&filp->f_lock);

As the example in comment above this function, the read maybe still
sequential, and it will waste IO bandwith if modify to FMODE_RANDOM
directly.
Yes immediately disabling readahead may hurt IO performance, the
original '/ 4' may perform better when there are only 1-3 IO errors
encountered.
Hi Fengguang,

Why the number should be 1-3?
The original behavior is '/= 4' on each error.

After 1 errors, readahead size will be shrinked by 1/4
After 2 errors, readahead size will be shrinked by 1/16
After 3 errors, readahead size will be shrinked by 1/64
After 4 errors, readahead size will be effectively 0 (disabled)
But from function shrink_readahead_size_eio and its caller
filemap_fault I can't find the behavior you mentioned. How you
figure out it?
It's this line in shrink_readahead_size_eio():

         ra->ra_pages /= 4;

Yeah, I mean why the 4th readahead size will be 0(disabled)? What's the original value of ra->ra_pages? How can guarantee the 4th shrink readahead size can be 0?

Regards,
Chen


That ra_pages will keep shrinking by 4 on each error. The only way to
restore it is to reopen the file, or POSIX_FADV_SEQUENTIAL.

Thanks,
Fengguang


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]