On 07/23/2012 12:04 AM, Hugh Dickins wrote:
Please don't be upset if I say that I don't like either of your patches.
Mainly for obvious reasons - I don't like Mel's because anything with
trylock retries and nested spinlocks worries me before I can even start
to think about it; and I don't like Michal's for the same reason as Mel,
that it spreads more change around in common paths than we would like.
I have a naive question.
In huge_pmd_share, we protect ourselves by taking
the mapping->i_mmap_mutex.
Is there any reason we could not take the i_mmap_mutex
in the huge_pmd_unshare path?
I see that hugetlb_change_protection already takes that
lock. Is there something preventing __unmap_hugepage_range
from also taking mapping->i_mmap_mutex?
That way the sharing and the unsharing code are
protected by the same, per shm segment, lock.