Re: Asynchronous read-ahead

David S. Miller (
Tue, 9 Apr 1996 00:12:06 -0400

Date: Mon, 8 Apr 1996 22:34:55 +0000 (GMT)
From: Gerard Roudier <>

> Just an idea.. If we want asynchronous read-ahead, shouldn't it be done best
> by a kernel-thread?

Process context switching is bad since TLB must be invalidated.
I am not a Linux Guru. However if the switching to a kernel-thread invalidate
TLB on mono-processor machine, then I donnot agree with your idea.
On the other hand, I think that it is easy to implement asynchronous read_ahead
as simple asynchronous IO requests.

On the I386 a kernel thread switch does indeed flush the TLB (but tlb
flushes on the intel are cheap and Linus could optimize this away if
he wanted to) However on the Sparc, for example, a kernel thread
switch does not cost a TLB flush at all. It is as expensive as a
non-local goto basically, on the Sparc.

In fact, on the Sparc, in a case such as the following:

time 1) user thread pid=5 sleeps
time 2) kernel switches to kernel thread (kswapd or whatever)
time 3) kernel switches back to user thread pid=5

There will not be one TLB/cache flush generated (unless kswapd or
whatever kernel daemon messes with page tables, but that is a
completely different matter altogether).

David S. Miller