On 03/14/2013 10:50 AM, Kirill A. Shutemov wrote: > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -113,11 +113,20 @@ extern void __split_huge_page_pmd(struct vm_area_struct *vma, > __split_huge_page_pmd(__vma, __address, \ > ____pmd); \ > } while (0) > -#define wait_split_huge_page(__anon_vma, __pmd) \ > +#define wait_split_huge_page(__vma, __pmd) \ > do { \ > pmd_t *____pmd = (__pmd); \ > - anon_vma_lock_write(__anon_vma); \ > - anon_vma_unlock_write(__anon_vma); \ > + struct address_space *__mapping = \ > + vma->vm_file->f_mapping; \ > + struct anon_vma *__anon_vma = (__vma)->anon_vma; \ > + if (__mapping) \ > + mutex_lock(&__mapping->i_mmap_mutex); \ > + if (__anon_vma) { \ > + anon_vma_lock_write(__anon_vma); \ > + anon_vma_unlock_write(__anon_vma); \ > + } \ > + if (__mapping) \ > + mutex_unlock(&__mapping->i_mmap_mutex); \ > BUG_ON(pmd_trans_splitting(*____pmd) || \ > pmd_trans_huge(*____pmd)); \ > } while (0) That thing was pretty ugly _before_. :) Any chance this can get turned in to a function? What's the deal with the i_mmap_mutex operation getting split up? I'm blanking on what kind of pages would have both anon_vmas and a valid mapping. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>