Skip to contentSkip to conversation

changing mm->mmap_sem (was: Re: system call for process information?)

DISCUSSION Rik van Riel 2 participants 3 messages Mar 18, 2001 – Mar 19, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · Linus Torvalds

In article <Pine.LNX.4.21.0103181122480.13050-100000@imladris.rielhome.conectiva>,

Quoted 8 lines · Rik van Riel

OK, I'll write some code to prevent multiple threads from stepping all over each other when they pagefault at the same address.

What would be the preferred method of fixing this ?

- fixing do_swap_page and all ->nopage functions

Quoted 7 lines

There is no need to fix gthe "nopage" functions. They never see the page table directly anyway.

So the only thing that _should_ be needed is to make sure that do_no_page(), do_swap_page() and do_anonymous_page() will re-aquire the mm->page_table_lock and undo their work if it turns out that the page table entry is no longer empty..

... in which case concurrency is maximised, but there is a possibility of doing double work...

Quoted 6 lines
Quoted 2 lines

- hacking handle_mm_fault to make sure no overlapping pagefaults will be served at the same time

No. The whole reason the rw_semaphores were done in the first place was to allow page faults to happen concurrently to allow threaded applictions to scale up even when faulting.

Indeed, having threaded apps do multiple page faults at the same time is the main goal of this patch. However, I don't see how it would be good for scalability to have multiple threads fault in the same page at the same time, when they could just wait for one of them to do the work.

Only faults for different addresses would proceed, not faults for the same address...

regards,

Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/

#2 lore raw
Quoted 6 lines · Rik van Riel

Indeed, having threaded apps do multiple page faults at the same time is the main goal of this patch. However, I don't see how it would be good for scalability to have multiple threads fault in the same page at the same time, when they could just wait for one of them to do the work.

But they will.

That's what lock_page() etc are there for - there's no need for the VM to synchronize because we already have the synchronization primitives at a lower level.

And there isn't any other lock that could work anyway. It's either the whole MM or a page. There's nothing in between.

Linus

#3 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 6 lines · Rik van Riel

Indeed, having threaded apps do multiple page faults at the same time is the main goal of this patch. However, I don't see how it would be good for scalability to have multiple threads fault in the same page at the same time, when they could just wait for one of them to do the work.

Quoted 5 lines

But they will.

That's what lock_page() etc are there for - there's no need for the VM to synchronize because we already have the synchronization primitives at a lower level.

Indeed. I'll go multithread the do_no_page and do_swap_page functions tomorrow (maybe even tonight ;)).

regards,

Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/