Re: [PATCH 01 of 12] Core of mmu notifiers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrea Arcangeli
Date: Monday, April 28, 2008 - 5:10 pm

On Mon, Apr 28, 2008 at 01:34:11PM -0700, Christoph Lameter wrote:

I'd hoped to discuss this topic after mmu-notifier-core was already
merged, but let's do it anyway.

My point of view is that there was no rcu when I wrote that code, yet
there was no reference count and yet all locking looks still exactly
the same as I wrote it. There's even still the page_table_lock to
serialize threads taking the mmap_sem in read mode against the first
vma->anon_vma = anon_vma during the page fault.

Frankly I've absolutely no idea why rcu is needed in all rmap code
when walking the page->mapping. Definitely the PG_locked is taken so
there's no way page->mapping could possibly go away under the rmap
code, hence the anon_vma can't go away as it's queued in the vma, and
the vma has to go away before the page is zapped out of the pte.

So there are some possible scenarios:

1) my original anon_vma code was buggy not taking the rcu_read_lock()
and somebody fixed it (I tend to exclude it)

2) somebody has seen a race that doesn't exist and didn't bother to
document it other than with this obscure comment

 * Getting a lock on a stable anon_vma from a page off the LRU is
 * tricky: page_lock_anon_vma rely on RCU to guard against the races.

I tend to exclude it too as VM folks are too smart for this to be the case.

3) somebody did some microoptimization using rcu and we surely can
undo that microoptimization to get the code back to my original code
that didn't need rcu despite it worked exactly the same, and that is
going to be cheaper to use with semaphores than doubling the number of
locked ops for every lock instruction.

Now the double atomic op may not be horrible when not contented, as it
works on the same cacheline but with cacheline bouncing with
contention it sounds doubly horrible than a single cacheline bounce
and I don't see the point of it as you can't use rcu anyways, so you
can't possibly take advantage of whatever microoptimization done over
the original locking.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00 of 12] mmu notifier #v13, Andrea Arcangeli, (Tue Apr 22, 6:51 am)
[PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 22, 6:51 am)
[PATCH 07 of 12] Add a function to rw_semaphores to check ..., Andrea Arcangeli, (Tue Apr 22, 6:51 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Eric Dumazet, (Tue Apr 22, 7:56 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 22, 8:15 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Avi Kivity, (Tue Apr 22, 8:24 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Eric Dumazet, (Tue Apr 22, 8:37 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 22, 9:46 am)
Re: [PATCH 00 of 12] mmu notifier #v13, Robin Holt, (Tue Apr 22, 11:22 am)
Re: [PATCH 00 of 12] mmu notifier #v13, Andrea Arcangeli, (Tue Apr 22, 11:43 am)
Re: [PATCH 00 of 12] mmu notifier #v13, Robin Holt, (Tue Apr 22, 12:42 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Tue Apr 22, 1:19 pm)
Re: [PATCH 02 of 12] Fix ia64 compilation failure because ..., Christoph Lameter, (Tue Apr 22, 1:22 pm)
Re: [PATCH 03 of 12] get_task_mm should not succeed if mmp ..., Christoph Lameter, (Tue Apr 22, 1:23 pm)
Re: [PATCH 04 of 12] Moves all mmu notifier methods outsid ..., Christoph Lameter, (Tue Apr 22, 1:24 pm)
Re: [PATCH 05 of 12] Move the tlb flushing into free_pgtab ..., Christoph Lameter, (Tue Apr 22, 1:25 pm)
Re: [PATCH 10 of 12] Convert mm_lock to use semaphores aft ..., Christoph Lameter, (Tue Apr 22, 1:26 pm)
Re: [PATCH 00 of 12] mmu notifier #v13, Christoph Lameter, (Tue Apr 22, 1:28 pm)
Re: [PATCH 00 of 12] mmu notifier #v13, Christoph Lameter, (Tue Apr 22, 1:30 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Tue Apr 22, 1:31 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 22, 3:35 pm)
Re: [PATCH 02 of 12] Fix ia64 compilation failure because ..., Andrea Arcangeli, (Tue Apr 22, 3:43 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Tue Apr 22, 4:07 pm)
Re: [PATCH 03 of 12] get_task_mm should not succeed if mmp ..., Christoph Lameter, (Tue Apr 22, 4:13 pm)
Re: [PATCH 04 of 12] Moves all mmu notifier methods outsid ..., Christoph Lameter, (Tue Apr 22, 4:14 pm)
Re: [PATCH 10 of 12] Convert mm_lock to use semaphores aft ..., Christoph Lameter, (Tue Apr 22, 4:19 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Tue Apr 22, 4:20 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Jack Steiner, (Tue Apr 22, 5:28 pm)
Re: [PATCH 00 of 12] mmu notifier #v13, Jack Steiner, (Tue Apr 22, 5:31 pm)
Re: [PATCH 00 of 12] mmu notifier #v13, Andrea Arcangeli, (Wed Apr 23, 6:33 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 6:36 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Wed Apr 23, 7:47 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 8:59 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 9:26 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 9:37 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Jack Steiner, (Wed Apr 23, 10:09 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 10:24 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 10:45 am)
Re: [PATCH 04 of 12] Moves all mmu notifier methods outsid ..., Christoph Lameter, (Wed Apr 23, 11:02 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:09 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:15 am)
Re: [PATCH 04 of 12] Moves all mmu notifier methods outsid ..., Andrea Arcangeli, (Wed Apr 23, 11:16 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:19 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 11:19 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:21 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 11:25 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:27 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 11:34 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 11:37 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Wed Apr 23, 11:46 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 3:19 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed Apr 23, 11:49 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Thu Apr 24, 2:51 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Thu Apr 24, 8:39 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Thu Apr 24, 10:41 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Sat Apr 26, 6:17 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Sat Apr 26, 7:04 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Sun Apr 27, 5:27 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Mon Apr 28, 1:34 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Mon Apr 28, 5:10 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Christoph Lameter, (Mon Apr 28, 6:28 pm)
Re: [PATCH 01 of 12] Core of mmu notifiers, Hugh Dickins, (Tue Apr 29, 3:49 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 29, 6:32 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 29, 8:30 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Robin Holt, (Tue Apr 29, 8:50 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Tue Apr 29, 9:03 am)
Re: [PATCH 01 of 12] Core of mmu notifiers, Andrea Arcangeli, (Wed May 7, 8:00 am)