From: Davidlohr Bueso <dave@stgolabs.net>
To: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: mingo@kernel.org, peterz@infradead.org,
akpm@linux-foundation.org, jack@suse.cz,
kirill.shutemov@linux.intel.com, mhocko@suse.com,
mgorman@techsingularity.net, linux-kernel@vger.kernel.org,
Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 1/5] locking: Introduce range reader/writer lock
Date: Mon, 3 Apr 2017 08:26:43 -0700 [thread overview]
Message-ID: <20170403152643.GB2270@linux-80c1.suse> (raw)
In-Reply-To: <20170403161917.4ef46f17@nimbus>
On Mon, 03 Apr 2017, Laurent Dufour wrote:
>Le Tue, 28 Mar 2017 09:39:18 -0700,
>Davidlohr Bueso <dave@stgolabs.net> a écrit :
>> I'll wait to see if there are any more concerns and send a v2 with
>> your corrections.
>
>Hi Bavidlohr, I think there is a major issue regarding the task
>catching a signal in wait_for_range().
>I can see it when a thread is catching a signal, the process deadlock
>in exit path.
>
>Let's imagine all these tasks waiting for the complete range lock, so
>range doesn't matter:
>
>A get the lock in write
>B want the read lock => B->blocking_range=1 (because of A)
>C want the write lock => C->blocking_range=2 (A,B)
>D want the read lock => D->blocking_range=3 (A,B,C)
>=> C catch a signal and exit wait_for_ranges()
>A release the lock
> => B->blocking_range=0
> => D->blocking_range=2 (D has not seen C removal)
>=> B get the lock
>B release the lock
> => D->blocking_range=1
>
>D remains blocked while no one has the lock !
>
>The issue is when removing a task from the interval tree, we
>should decrement all the blocking_ranges of the task added to that
>range after the one leaving... I can't see an easy fix for that :(
>
>Am I right ?
Yes. Peter had also mentioned the issue too. One way I though of fixing
the problem was to track the jiffies timestamp in a per range_rwlock
basis for when it was added, and in the signal_pending() case, along with
removing the lock from the tree, we iterate the tree again and decrement
the blocking_ranges for those with a higher timestamp. It would add some
overhead, but again this is the unlikely() case. It also adds an extra 8
bytes of footprint, but this is usually stack allocated.
Thanks,
Davidlohr
next prev parent reply other threads:[~2017-04-03 15:26 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 5:03 [PATCH 0/5] locking Introduce range reader/writer lock Davidlohr Bueso
2017-03-07 5:03 ` [PATCH 1/5] locking: " Davidlohr Bueso
2017-03-09 11:03 ` Jan Kara
2017-03-28 10:00 ` Laurent Dufour
2017-03-28 16:39 ` Davidlohr Bueso
2017-03-28 16:58 ` Kirill A. Shutemov
2017-03-29 8:38 ` Laurent Dufour
2017-03-29 15:31 ` Davidlohr Bueso
2017-03-29 15:40 ` Kirill A. Shutemov
2017-03-29 16:10 ` Davidlohr Bueso
2017-04-03 14:19 ` Laurent Dufour
2017-04-03 15:26 ` Davidlohr Bueso [this message]
2017-04-03 16:06 ` Jan Kara
2017-04-04 15:31 ` Davidlohr Bueso
2017-03-29 8:56 ` Peter Zijlstra
2017-03-29 15:12 ` Davidlohr Bueso
2017-03-29 8:59 ` Peter Zijlstra
2017-03-29 9:08 ` Peter Zijlstra
2017-03-29 15:05 ` Davidlohr Bueso
2017-03-29 9:11 ` Peter Zijlstra
2017-03-29 9:44 ` Peter Zijlstra
2017-03-29 10:35 ` Peter Zijlstra
2017-03-29 10:49 ` Peter Zijlstra
2017-03-29 15:14 ` Davidlohr Bueso
2017-03-30 14:56 ` Laurent Dufour
2017-03-30 17:13 ` Davidlohr Bueso
2017-03-07 5:03 ` [PATCH 2/5] locking/locktorture: Fix rwsem reader_delay Davidlohr Bueso
2017-03-07 5:03 ` [PATCH 3/5] locking/locktorture: Fix num reader/writer corner cases Davidlohr Bueso
2017-03-07 5:03 ` [PATCH 4/5] locking/locktorture: Support range rwlocks Davidlohr Bueso
2017-03-07 5:03 ` [PATCH 5/5] staging/lustre: Use generic range rwlock Davidlohr Bueso
2017-03-07 6:05 ` Oleg Drokin
2017-03-08 15:02 ` Davidlohr Bueso
2017-03-09 8:56 ` kbuild test robot
2017-03-09 14:40 ` kbuild test robot
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=20170403152643.GB2270@linux-80c1.suse \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=ldufour@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/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