[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090412084819.GA25314@elte.hu>
Date: Sun, 12 Apr 2009 10:48:19 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Wu Fengguang <fengguang.wu@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Vladislav Bolkhovitin <vst@...b.net>,
Jens Axboe <jens.axboe@...cle.com>,
Jeff Moyer <jmoyer@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 3/3] readahead: introduce context readahead algorithm
* Wu Fengguang <fengguang.wu@...el.com> wrote:
> Introduce page cache context based readahead algorithm.
> This is to better support concurrent read streams in general.
> /*
> + * Count contiguously cached pages from @offset-1 to @offset-@max,
> + * this count is a conservative estimation of
> + * - length of the sequential read sequence, or
> + * - thrashing threshold in memory tight systems
> + */
> +static pgoff_t count_history_pages(struct address_space *mapping,
> + struct file_ra_state *ra,
> + pgoff_t offset, unsigned long max)
> +{
> + pgoff_t head;
> +
> + rcu_read_lock();
> + head = radix_tree_prev_hole(&mapping->page_tree, offset - 1, max);
> + rcu_read_unlock();
> +
> + return offset - 1 - head;
> +}
Very elegant method! I suspect this will work far better
than adding various increasingly more complex heuristics.
Emphatically-Acked-by: Ingo Molnar <mingo@...e.hu>
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists