2006-05-24 11:22:29

by Wu Fengguang

[permalink] [raw]
Subject: [PATCH 28/33] readahead: loop case

Disable look-ahead for loop file.

Loopback files normally contain filesystems, in which case there are already
proper look-aheads in the upper layer, more look-aheads on the loopback file
only ruins the read-ahead hit rate.

Signed-off-by: Wu Fengguang <[email protected]>
---

I'd like to thank Tero Grundstr?m for uncovering the loopback problem.

drivers/block/loop.c | 6 ++++++
1 files changed, 6 insertions(+)

--- linux-2.6.17-rc4-mm3.orig/drivers/block/loop.c
+++ linux-2.6.17-rc4-mm3/drivers/block/loop.c
@@ -779,6 +779,12 @@ static int loop_set_fd(struct loop_devic
mapping = file->f_mapping;
inode = mapping->host;

+ /*
+ * The upper layer should already do proper look-ahead,
+ * one more look-ahead here only ruins the cache hit rate.
+ */
+ file->f_ra.flags |= RA_FLAG_NO_LOOKAHEAD;
+
if (!(file->f_mode & FMODE_WRITE))
lo_flags |= LO_FLAGS_READ_ONLY;


--


2006-05-24 14:01:46

by Limin Wang

[permalink] [raw]
Subject: Re: [PATCH 28/33] readahead: loop case


If the loopback files is bigger than the memory size, it may cause miss again and
may better to turn on the read ahead?


Regards,
Limin
* Wu Fengguang <[email protected]> [2006-05-24 19:13:14 +0800]:

> Disable look-ahead for loop file.
>
> Loopback files normally contain filesystems, in which case there are already
> proper look-aheads in the upper layer, more look-aheads on the loopback file
> only ruins the read-ahead hit rate.
>
> Signed-off-by: Wu Fengguang <[email protected]>
> ---
>
> I'd like to thank Tero Grundstr?m for uncovering the loopback problem.
>
> drivers/block/loop.c | 6 ++++++
> 1 files changed, 6 insertions(+)
>
> --- linux-2.6.17-rc4-mm3.orig/drivers/block/loop.c
> +++ linux-2.6.17-rc4-mm3/drivers/block/loop.c
> @@ -779,6 +779,12 @@ static int loop_set_fd(struct loop_devic
> mapping = file->f_mapping;
> inode = mapping->host;
>
> + /*
> + * The upper layer should already do proper look-ahead,
> + * one more look-ahead here only ruins the cache hit rate.
> + */
> + file->f_ra.flags |= RA_FLAG_NO_LOOKAHEAD;
> +
> if (!(file->f_mode & FMODE_WRITE))
> lo_flags |= LO_FLAGS_READ_ONLY;
>
>
> --
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2006-05-25 15:48:44

by Wu Fengguang

[permalink] [raw]
Subject: Re: [PATCH 28/33] readahead: loop case

On Wed, May 24, 2006 at 10:01:35PM +0800, Limin Wang wrote:
>
> If the loopback files is bigger than the memory size, it may cause miss again and
> may better to turn on the read ahead?
>

The readahead is always on, it's only disabling lookahead :-)

> > Disable look-ahead for loop file.
> >
> > Loopback files normally contain filesystems, in which case there are already
> > proper look-aheads in the upper layer, more look-aheads on the loopback file
> > only ruins the read-ahead hit rate.