Re: global kernel lock

Andi Kleen (ak@muc.de)
Fri, 13 Nov 1998 23:06:30 +0100


On Fri, Nov 13, 1998 at 09:33:18PM +0100, Linus Torvalds wrote:
>
>
>
> Yes. You missed kswapd and synchronous processes trying to make more
> memory available, walking and modifying page tables behind your back
> unless you hold the kernel lock.

Thank you for correcting me.

>
> That's why we can unlock early in the (very common) case of doing an new
> anonymous page: nobody is going to _add_ entries to the page tables
> without holding the mm semaphore, and the anonymous page case doesn't need
> the kernel lock for anything else either.

There seems to be another race: running do_anonymous_page outside the global
lock relies on put_page/set_pte being atomic.

set_pte is

#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))

on i386. Nobody gurantees that gcc generates an atomic sequence for this
statement, also it needs a memory barrier to avoid SMP inconsisties.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/