All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <wfg@mail.ustc.edu.cn>
To: Bart Samwel <bart@samwel.tk>
Cc: Voluspa <lista1@comhem.se>, linux-kernel@vger.kernel.org
Subject: Re: Adaptive Readahead V14 - statistics question...
Date: Tue, 6 Jun 2006 11:34:36 +0800	[thread overview]
Message-ID: <349564851.10398@ustc.edu.cn> (raw)
Message-ID: <20060606033436.GB6071@mail.ustc.edu.cn> (raw)
In-Reply-To: <448493E9.9030203@samwel.tk>

On Mon, Jun 05, 2006 at 10:28:25PM +0200, Bart Samwel wrote:
> Hi Mats, Wu,
> 
> Hmmm, video at 1 Mb/s = 128 kB/s (just guessing a typical bitrate) 
> equals 8 seconds between reads at 1 MB readahead, right? That's strange, 
> you should be hearing those sounds normally as well then, as a typical 
> Linux laptop setup accesses the disk less frequently than once every 8 
> seconds. Anyway, _increasing_ the maximum readahead to some film-decent 
> value will probably get rid of the clicking as well.
> 
> I guess the problem is getting this to work without disturbing other 
> applications, i.e. without making slow-but-predictably-reading 
> applications read ahead 10 MB as well. I've been struggling with this 
> with laptop mode for quite some time: last time I checked, there didn't 
> seem to be a good way to do video readahead without making all other 
> reads read ahead too much as well... What I'd like to have is a setting 
> that works based on _time_, so that I can say "read all you think will 
> be needed in the next N seconds".
> 
> I could imagine having the maximum readahead being composed of two settings:
> 
> MAX_BYTES = maximum readahead in bytes
> MAX_TIME = maximum readahead in *time* before the data is expected to be 
> needed
> 
> For instance, if MAX_BYTES = 50MB and MAX_TIME=180 seconds, an 
> application reading at 10 kB/s would get a max readahead of 180*10 = 
> 1800kB, while an application reading at 100 kB/s would get a max 
> readahead of 180*100 = 18000kB. As a use case, the first application 
> would be xmms (128kbit MP3), while the second would be mplayer (800kbit 
> video). In both cases, laptop mode would be able to spin down the disk 
> for a full three minutes between spinups. Ideal for when you're trying 
> to watch a video while on the road.
> 
> Wu, do the adaptive readahead patches have something like this, or could 
> it be included? It would solve a _major_ problem for laptop mode.

Yes, it has the capability you need.

And MAX_TIME is not necessary for this case.
It does not try to estimate the time, but the relative speeds of all
concurrent readers. It automatically arranges appropriate readahead
sizes for all the concurrent readers, so that no readahead thrashing
will happen, provided that the reading speeds do not fluctuate too
much.

However there are some cases not thrashing protected:
        - normal mmapped reading(without POSIX_FADV_SEQUENTIAL hint);
        - backward reading;
        - fs stuffs(i.e. readahead for dirs);

With that in mind, you can safely set max readahead size to as large
as 255M when watching videos by doing the following tricks:

blockdev --setra 524280 /dev/hda[N]     # following opened file will use this aggressive size
mplayer <your video file on hda[N]>     # open it
blockdev --setra 2048 /dev/hda[N]       # revert to sane value
# now continue watching video ...

Cheers,
Wu

  parent reply	other threads:[~2006-06-06  3:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-30  3:36 Adaptive Readahead V14 - statistics question Voluspa
2006-05-30  6:40 ` Wu Fengguang
2006-05-30  6:40   ` Wu Fengguang
2006-05-30 16:49 ` Valdis.Kletnieks
2006-05-31 21:06   ` Diego Calleja
2006-05-31 21:50   ` Voluspa
2006-06-01  5:51     ` Fengguang Wu
2006-06-01  5:51       ` Fengguang Wu
2006-06-01  6:35         ` Voluspa
2006-06-08  8:04         ` Voluspa
2006-06-08 11:37           ` adaptive readahead overheads Fengguang Wu
2006-06-08 11:37             ` Fengguang Wu
2006-06-08 12:25               ` Voluspa
2006-06-08 12:39                 ` Fengguang Wu
2006-06-08 12:39                   ` Fengguang Wu
2006-06-08 13:05                 ` Andi Kleen
2006-06-08 14:00                   ` Jens Axboe
     [not found] ` <448493E9.9030203@samwel.tk>
2006-06-06  3:34   ` Wu Fengguang [this message]
2006-06-06  3:34     ` Adaptive Readahead V14 - statistics question Wu Fengguang
  -- strict thread matches above, loose matches on Subject: below --
2006-06-04  7:34 [PATCH] readahead: initial method - expected read size - fix fastcall Fengguang Wu
2006-06-04  7:34 ` Fengguang Wu
2006-06-04  9:07   ` Andrew Morton
2006-06-04  9:25     ` Arjan van de Ven
2006-06-05  1:17       ` Voluspa
2006-06-05  8:00         ` Arjan van de Ven
2006-06-06  2:26         ` Fengguang Wu
2006-06-06  2:26           ` Fengguang Wu
2006-06-08  7:31             ` Voluspa
2006-06-08  7:57               ` Fengguang Wu
2006-06-08  7:57                 ` Fengguang Wu
2006-06-06  2:57         ` Fengguang Wu
2006-06-06  2:57           ` Fengguang Wu
2006-06-08  7:43             ` Voluspa
2006-06-08  8:13               ` Fengguang Wu
2006-06-08  8:13                 ` Fengguang Wu
2006-06-08  8:28                   ` Voluspa
2006-06-08  8:50                     ` Fengguang Wu
2006-06-08  8:50                       ` Fengguang Wu
2006-06-08 10:04                         ` Voluspa
2006-06-04 12:13     ` [PATCH] readahead: call scheme - fix fastcall readahead_cache_hit() Fengguang Wu
2006-06-04 12:13       ` Fengguang Wu
2006-05-29 19:44 Adaptive Readahead V14 - statistics question Valdis.Kletnieks
2006-05-30  0:37 ` Wu Fengguang
2006-05-30  0:37   ` Wu Fengguang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=349564851.10398@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=bart@samwel.tk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lista1@comhem.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.