linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.vnet.ibm.com>
To: Shady Issa <shady.issa@oracle.com>,
	Alex Kogan <alex.kogan@oracle.com>,
	Dave Dice <dave.dice@oracle.com>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	jack@suse.com, linux-mm@kvack.org
Subject: Re: using range locks instead of mm_sem
Date: Fri, 24 Aug 2018 09:40:59 +0200	[thread overview]
Message-ID: <744f3cf3-d4ec-e3a6-e56d-8009dd8c5f14@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180822144640.GB3677@linux-r8p5>

On 22/08/2018 16:46, Davidlohr Bueso wrote:
> On Wed, 22 Aug 2018, Shady Issa wrote:
> 
>>
>> Hi Davidlohr,
>>
>> I am interested in the idea of using range locks to replace mm_sem. I wanted to
>> start trying out using more fine-grained ranges instead of the full range
>> acquisitions
>> that are used in this patch (https://lkml.org/lkml/2018/2/4/235). However, it
>> does not
>> seem straight forward to me how this is possible.
>>
>> First, the ranges that can be defined before acquiring the range lock based
>> on the
>> caller's input(i.e. ranges supplied by mprotect, mmap, munmap, etc.) are
>> oblivious of
>> the underlying VMAs. Two non-overlapping ranges can fall within the same VMA and
>> thus should not be allowed to run concurrently in case they are writes.
> 
> Yes. This is a _big_ issue with range locking the addr space. I have yet
> to find a solution other than delaying vma modifying ops to avoid the races,
> which is fragile. Obviously locking the full range in such scenarios cannot
> be done either.

I think the range locked should be aligned to the underlying VMA plus one page
on each side to prevent that VMA to be merged.
But this raises a concern with the VMA merging mechanism which tends to limit
the number of VMAs and could lead to a unique VMA, limiting the advantage of a
locking based on the VMA's boundaries.

>>
>> Second, even if ranges from the caller function are aligned with VMAs, the
>> extent of the
>> effect of operation is unknown. It is probable that an operation touching one
>> VMA will
>> end up performing modifications to the VMAs rbtree structure due to splits,
>> merges, etc.,
>> which requires the full range acquisition and is unknown beforehand.
> 
> Yes, this is similar to the above as well.
> 
>>
>> I was wondering if I am missing something with this thought process, because
>> with the
>> current givings, it seems to me that range locks will boil down to just r/w
>> semaphore.
>> I would also be very grateful if you can point me to any more recent
>> discussions regarding
>> the use of range locks after this patch from February.
> 
> You're on the right page.
> 
> Thanks,
> Davidlohr
> 

  reply	other threads:[~2018-08-24  7:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 13:51 Shady Issa
2018-08-22 14:46 ` Davidlohr Bueso
2018-08-24  7:40   ` Laurent Dufour [this message]
2018-08-24 15:39     ` Shady Issa
2018-08-27 19:41       ` Alex Kogan
2018-08-28  7:51         ` Laurent Dufour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=744f3cf3-d4ec-e3a6-e56d-8009dd8c5f14@linux.vnet.ibm.com \
    --to=ldufour@linux.vnet.ibm.com \
    --cc=alex.kogan@oracle.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dave.dice@oracle.com \
    --cc=jack@suse.com \
    --cc=linux-mm@kvack.org \
    --cc=shady.issa@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox