Skip to contentSkip to conversation

3rd version of R/W mmap_sem patch available

DISCUSSION Manfred Spraul 3 participants 6 messages Mar 19, 2001 – Mar 20, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

Besides, the fair semaphores would potentially slow things down, while this potentially speeds things up. So.. It looks obvious enough.

Rik, did you check that {pte,pmd}_alloc are thread safe? At least in 2.4.2 they aren't (include/asm-i386/pgalloc.h), and your patch doesn't touch pgalloc.

{pte,pmd}_alloc are called from handle_mm_fault, and that function is now running with down_read().
--

Manfred

#1 lore raw
Quoted 4 lines · Manfred Spraul

Rik, did you check that {pte,pmd}_alloc are thread safe? At least in 2.4.2 they aren't (include/asm-i386/pgalloc.h), and your patch doesn't touch pgalloc.

Excellent point. We used to do all the looping and re-trying, but it got ripped out a long time ago (and in any case, it historically didn't do SMP, so the old code doesn't really work).

Linus

#2 lore raw
Quoted 4 lines · Linus Torvalds

Excellent point. We used to do all the looping and re-trying, but it got ripped out a long time ago (and in any case, it historically didn't do SMP, so the old code doesn't really work).

Actually, funnily enough, I see that the old thread-safe stuff is still there in get_pte_kernel_slow(). The only thing that breaks it is that we don't hold any locks, so it's only UP-safe, not SMP-safe.

However, it definitely looks like we should just un-inline that thing completely, and make a lot of it architecture-independent anyway.

Linus

#4 lore raw
In reply to Manfred Spraul
Quoted 7 lines · Manfred Spraul
Quoted 3 lines

Besides, the fair semaphores would potentially slow things down, while this potentially speeds things up. So.. It looks obvious enough.

Rik, did you check that {pte,pmd}_alloc are thread safe? At least in 2.4.2 they aren't (include/asm-i386/pgalloc.h), and your patch doesn't touch pgalloc.

I checked and they're not. This still needs to be fixed...

(ie the patch really isn't ready yet to be included in the main kernel ... OTOH, the changes needed to make it ready are all trivial and tedious ;))

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

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/

#3 lore raw
In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Linus Torvalds

Excellent point. We used to do all the looping and re-trying, but it got ripped out a long time ago (and in any case, it historically didn't do SMP, so the old code doesn't really work).

Quoted 6 lines

Actually, funnily enough, I see that the old thread-safe stuff is still there in get_pte_kernel_slow(). The only thing that breaks it is that we don't hold any locks, so it's only UP-safe, not SMP-safe.

However, it definitely looks like we should just un-inline that thing completely, and make a lot of it architecture-independent anyway.

Also, because lots of architectures seem to have exactly the same code, we might as well remove the duplicates and put them in the same place...

regards,

Rik
--
Linux MM bugzilla: http://linux-mm.org/bugzilla.shtml

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/

#5 lore raw
In reply to Rik van Riel
Quoted 4 lines · Rik van Riel

(ie the patch really isn't ready yet to be included in the main kernel ... OTOH, the changes needed to make it ready are all trivial and tedious ;))

They are trivial and tedious only if done wrong - which will also add tons of new places where we lock and unlock only to lock again.

My -pre5 has the non-trivial "fix the calling convention and require that pmd/pgd_alloc() be called with the lock held" version of the patch.

Linus