From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbdC2PMd (ORCPT ); Wed, 29 Mar 2017 11:12:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:39980 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751288AbdC2PMb (ORCPT ); Wed, 29 Mar 2017 11:12:31 -0400 Date: Wed, 29 Mar 2017 08:12:20 -0700 From: Davidlohr Bueso To: Peter Zijlstra Cc: mingo@kernel.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 Message-ID: <20170329151220.GE27446@linux-80c1.suse> References: <1488863010-13028-1-git-send-email-dave@stgolabs.net> <1488863010-13028-2-git-send-email-dave@stgolabs.net> <20170329085626.rtudonk7bqzoy3vm@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170329085626.rtudonk7bqzoy3vm@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 29 Mar 2017, Peter Zijlstra wrote: >On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote: >> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig >> index 88e01e08e279..e4d9eadd2c47 100644 >> --- a/drivers/gpu/drm/Kconfig >> +++ b/drivers/gpu/drm/Kconfig >> @@ -154,7 +154,6 @@ config DRM_RADEON >> select HWMON >> select BACKLIGHT_CLASS_DEVICE >> select BACKLIGHT_LCD_SUPPORT >> - select INTERVAL_TREE >> help >> Choose this option if you have an ATI Radeon graphics card. There >> are both PCI and AGP versions. You don't need to choose this to >> @@ -174,7 +173,6 @@ config DRM_AMDGPU >> select HWMON >> select BACKLIGHT_CLASS_DEVICE >> select BACKLIGHT_LCD_SUPPORT >> - select INTERVAL_TREE >> help >> Choose this option if you have a recent AMD Radeon graphics card. >> >> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig >> index 183f5dc1c3f2..8a9154550f46 100644 >> --- a/drivers/gpu/drm/i915/Kconfig >> +++ b/drivers/gpu/drm/i915/Kconfig >> @@ -3,7 +3,6 @@ config DRM_I915 >> depends on DRM >> depends on X86 && PCI >> select INTEL_GTT >> - select INTERVAL_TREE >> # we need shmfs for the swappable backing store, and in particular >> # the shmem_readpage() which depends upon tmpfs >> select SHMEM > >I presume this is part of making INTERVAL_TREE unconditional; should be >a separate patch, no? Ok, I can separate it. >> +/* >> + * The largest range will span [0,RANGE_RWLOCK_INFINITY]. >> + */ >> +#define RANGE_RWLOCK_INFINITY (~0UL - 1) > >That's a strange limit, what's wrong with ~0UL ? Nothing, I was under the impression I had updated that. >> + >> +struct range_rwlock { >> + struct interval_tree_node node; >> + struct task_struct *task; >> + /* Number of ranges which are blocking acquisition of the lock */ >> + unsigned int blocking_ranges; >> + bool reader; >> +}; > >Hate the name; our rwlock is a spinlock, therefore this thing suggests >it is too. Hmmm not sure of a better name, kinda liked it. I'll see what I can come up with. > >Also, no bool in structures. Ok, but is that because sizeof(bool) can be undefined? In any case, I'm thinking we could skip the 'reader' member entirely and tag the task pointer (similar with what we do for other locks).