[lkml]   [2019]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 5/5] hugetlbfs: Limit wait time when trying to share huge PMD
On Wed, Sep 11, 2019 at 08:26:52PM -0700, Mike Kravetz wrote:
> All this got me wondering if we really need to take i_mmap_rwsem in write
> mode here. We are not changing the tree, only traversing it looking for
> a suitable vma.
> Unless I am missing something, the hugetlb code only ever takes the semaphore
> in write mode; never read. Could this have been the result of changing the
> tree semaphore to read/write? Instead of analyzing all the code, the easiest
> and safest thing would have been to take all accesses in write mode.

I was wondering the same thing. It was changed here:

commit 83cde9e8ba95d180eaefefe834958fbf7008cf39
Author: Davidlohr Bueso <>
Date: Fri Dec 12 16:54:21 2014 -0800

mm: use new helper functions around the i_mmap_mutex

Convert all open coded mutex_lock/unlock calls to the
i_mmap_[lock/unlock]_write() helpers.

and a subsequent patch said:

This conversion is straightforward. For now, all users take the write

There were subsequent patches which changed a few places

but I don't know why this one wasn't changed.

(I was also wondering about caching a potentially sharable page table
in the address_space to avoid having to walk the VMA tree at all if that
one happened to be sharable).

 \ /
  Last update: 2019-09-12 05:42    [W:0.096 / U:41.656 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site