Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753110AbdDCOT3 convert rfc822-to-8bit (ORCPT ); Mon, 3 Apr 2017 10:19:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58339 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752389AbdDCOT2 (ORCPT ); Mon, 3 Apr 2017 10:19:28 -0400 Date: Mon, 3 Apr 2017 16:19:17 +0200 From: Laurent Dufour To: Davidlohr Bueso 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 Subject: Re: [PATCH 1/5] locking: Introduce range reader/writer lock In-Reply-To: <20170328163918.GA27446@linux-80c1.suse> References: <1488863010-13028-1-git-send-email-dave@stgolabs.net> <1488863010-13028-2-git-send-email-dave@stgolabs.net> <2f7628f4-58e1-22c4-ccbe-3106c15cb405@linux.vnet.ibm.com> <20170328163918.GA27446@linux-80c1.suse> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 17040314-0040-0000-0000-0000035C565A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17040314-0041-0000-0000-000024CAEAB5 Message-Id: <20170403161917.4ef46f17@nimbus> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-03_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704030129 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 35 Le Tue, 28 Mar 2017 09:39:18 -0700, Davidlohr Bueso 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 ? Cheers, Laurent.