Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756675AbbEUUYa (ORCPT ); Thu, 21 May 2015 16:24:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54890 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756437AbbEUUYV (ORCPT ); Thu, 21 May 2015 16:24:21 -0400 From: jglisse@redhat.com To: akpm@linux-foundation.org Cc: , linux-mm@kvack.org, Linus Torvalds , , Mel Gorman , "H. Peter Anvin" , Peter Zijlstra , Andrea Arcangeli , Johannes Weiner , Larry Woodman , Rik van Riel , Dave Airlie , Brendan Conoboy , Joe Donohue , Duncan Poole , Sherry Cheung , Subhash Gutti , John Hubbard , Mark Hairgrove , Lucien Dunning , Cameron Buschardt , Arvind Gopalakrishnan , Haggai Eran , Shachar Raindel , Liran Liss , Roland Dreier , Ben Sander , Greg Stoner , John Bridgman , Michael Mantor , Paul Blinzer , Laurent Morichetti , Alexander Deucher , Oded Gabbay , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= Subject: [PATCH 23/36] HMM: allow to get pointer to spinlock protecting a directory. Date: Thu, 21 May 2015 16:22:59 -0400 Message-Id: <1432239792-5002-4-git-send-email-jglisse@redhat.com> In-Reply-To: <1432239792-5002-1-git-send-email-jglisse@redhat.com> References: <1432236705-4209-1-git-send-email-j.glisse@gmail.com> <1432239792-5002-1-git-send-email-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1949 Lines: 66 From: Jérôme Glisse Several use case for getting pointer to spinlock protecting a directory. Signed-off-by: Jérôme Glisse --- include/linux/hmm_pt.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/hmm_pt.h b/include/linux/hmm_pt.h index 36f7e00..27668a8 100644 --- a/include/linux/hmm_pt.h +++ b/include/linux/hmm_pt.h @@ -255,6 +255,16 @@ static inline void hmm_pt_directory_lock(struct hmm_pt *pt, spin_lock(&pt->lock); } +static inline spinlock_t *hmm_pt_directory_lock_ptr(struct hmm_pt *pt, + struct page *ptd, + unsigned level) +{ + if (level) + return &ptd->ptl; + else + return &pt->lock; +} + static inline void hmm_pt_directory_unlock(struct hmm_pt *pt, struct page *ptd, unsigned level) @@ -272,6 +282,13 @@ static inline void hmm_pt_directory_lock(struct hmm_pt *pt, spin_lock(&pt->lock); } +static inline spinlock_t *hmm_pt_directory_lock_ptr(struct hmm_pt *pt, + struct page *ptd, + unsigned level) +{ + return &pt->lock; +} + static inline void hmm_pt_directory_unlock(struct hmm_pt *pt, struct page *ptd, unsigned level) @@ -397,6 +414,13 @@ static inline void hmm_pt_iter_directory_lock(struct hmm_pt_iter *iter, hmm_pt_directory_lock(pt, iter->ptd[pt->llevel - 1], pt->llevel); } +static inline spinlock_t *hmm_pt_iter_directory_lock_ptr(struct hmm_pt_iter *iter, + struct hmm_pt *pt) +{ + return hmm_pt_directory_lock_ptr(pt, iter->ptd[pt->llevel - 1], + pt->llevel); +} + static inline void hmm_pt_iter_directory_unlock(struct hmm_pt_iter *iter, struct hmm_pt *pt) { -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/