On Tue, Jan 29, 2008 at 01:35:58PM -0800, Christoph Lameter wrote:^^^^^ hmm, "there" where? When I said it was taken in readonly mode I meant for the quoted code (it would be at the top if it wasn't cut), so I quote below again: The "there" for me was do_wp_page. Even for the code you quoted in freemap.c, the has_write_lock is set to 1 _only_ for the very first time you call sys_remap_file_pages on a VMA. Only the transition of the VMA between linear to nonlinear requires the mmap in write mode. So you can be sure all freemap code 99% of the time is populating (overwriting) already present ptes with only the mmap_sem in readonly mode like do_wp_page. It would be unnecessary to populate the nonlinear range with the mmap in write mode. Only the "vma" mangling requires the mmap_sem in write mode, the pte modifications only requires the PT_lock + mmap_sem in read mode. Effectively the first invocation of populate_range runs with the mmap_sem in write mode, I wonder why, there seem to be no good reason for that. I guess it's a bit that should be optimized, by calling downgrade_write before calling populate_range even for the first time the vma switches from linear to nonlinear (after the vma has been fully updated to the new status). But for sure all later invocations runs populate_range with the semaphore readonly like the rest of the VM does when instantiating ptes in the page faults. Yes. Yes. Yes. All pins are gone by the time invalidate_page/range returns. But there is no critical section between invalidate_page and the _later_ ptep_clear_flush. So get_user_pages is free to run and take the PT lock before the ptep_clear_flush, find the linux pte still instantiated, and to create a new spte, before ptep_clear_flush runs. Think of why the tlb flushes are being called at the end of ptep_clear_flush. The mmu notifier invalidate has to be called after for the exact same reason. Perhaps somebody else should explain this, I started exposing this smp race the moment after I've seen the backwards ordering being proposed in export-notifier-v1, sorry if I'm not clear enough. --
| Jeff Garzik | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Christoph Hellwig | Re: [malware-list] [RFC 0/5] [TALPA] Intro to a linux interface for on access scan... |
| Heiko Carstens | Re: -mm merge plans for 2.6.23 -- sys_fallocate |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| Jens Axboe | Re: [BUG] New Kernel Bugs |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Emmanuel Dreyfus | fixing send(2) semantics (kern/29750) |
| Christos Zoulas | Re: Melting down your network [Subject changed] |
| Juan RP | Changing the I/O scheduler on-the-fly |
| Emmanuel Dreyfus | Re: fixing send(2) semantics (kern/29750) |
