Re: if my new update_shared_mappings() races, vmtruncate is just racing , too

Linus Torvalds (torvalds@transmeta.com)
Wed, 23 Dec 1998 11:35:41 -0800 (PST)


On Wed, 23 Dec 1998, Andrea Arcangeli wrote:
?
> It seems to me that vmtruncate is playing with the pte/pgd of other
> processes without hoding any mmap_semaphore.
>
> I guess the reason this is safe is that lock_kernel protect us from
> another CPU that would play with pte/pgd at the same time.

Yes.

I tried to make us able to play with the page table entries without
holding the kernel lock, but it wasn't possible to do for 2.2.
Conceptually the mm semaphore _should_ serialize all accesses to the page
table, but making the page-out logic get the mm semaphore is just too
hard: I couldn't do it without some really obvious deadlock issues, and I
suspect it needs some serious designing to get right.

As a result, the rule really is: it's ok to _remove_ a page table entry
without holding the mm lock, but you have to hold the kernel lock to do
so. It's not a good rule, but it at least doesn't deadlock.

Linus

-
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/