Benjamin Herrenschmidt wrote:
Could it be an option to make it safe for the fault handler to temporarily drop the mmap_sem read lock given that some conditions TBD are met? In that case it can retake the mmap_sem write lock, do the VMA flags modifications, downgrade and do the pte modifications using a helper, or even use remap_pfn_range() during the time the write lock is held?When you drop and retake the mmap_sem, you need to start again from find_vma. At which point you technically probably want to start again from the architecture specfic fault code. It sounds difficult but I won't say it can't be done.I can be done with returning NOPAGE_REFAULT but as you said, I don't think it's necessary.
Still, even with NOPAGE_REFAULT or the equivalent with the new fault() code,in the case we need to take this route, (and it looks like we won't have to), I guess we still need to restart from find_vma() in the fault()/nopage() handler to make sure the VMA is still present. The object mutex need to be dropped as well to avoid deadlocks. Sounds complicated.
Cheers, Ben.
/Thomas - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- References:
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Thomas Hellstrom <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Nick Piggin <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- From: Benjamin Herrenschmidt <[email protected]>
- Re: [patch 3/3] mm: fault handler to replace nopage and populate
- Prev by Date: RE: [Cbe-oss-dev] [PATCH 09/14] spufs: add support for read/write oncntl
- Next by Date: [2.6.19 patch] drivers/char/specialix.c: fix the baud conversion
- Previous by thread: Re: [patch 3/3] mm: fault handler to replace nopage and populate
- Next by thread: Re: [patch 3/3] mm: fault handler to replace nopage and populate
- Index(es):