Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1253198

[PATCH v11 09/14] HMM: allow to get pointer to spinlock protecting a directory.

From Jérôme Glisse <jglisse@redhat.com>
Newsgroups linux.kernel
Subject [PATCH v11 09/14] HMM: allow to get pointer to spinlock protecting a directory.
Date 2015-10-21 22:20 +0200
Message-ID <qm81B-5gx-35@gated-at.bofh.it> (permalink)
References <qm81A-5gx-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Several use case for getting pointer to spinlock protecting a directory.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
---
 include/linux/hmm_pt.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/include/linux/hmm_pt.h b/include/linux/hmm_pt.h
index f745d6c..22100a6 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)
@@ -358,6 +375,14 @@ 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 *i)
+{
+	struct hmm_pt *pt = i->pt;
+
+	return hmm_pt_directory_lock_ptr(pt, i->ptd[pt->llevel - 1],
+					 pt->llevel);
+}
+
 static inline void hmm_pt_iter_directory_unlock(struct hmm_pt_iter *iter)
 {
 	struct hmm_pt *pt = iter->pt;
-- 
2.4.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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v11 00/14] HMM anomymous memory migration to device memory Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 07/14] HMM: mm add helper to update page table when migrating memory v2. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 06/14] HMM: mm add helper to update page table when migrating memory back v2. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 05/14] HMM: handle HMM device page table entry on mirror page table fault and update. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 11/14] HMM: add helpers for migration back to system memory v3. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 14/14] HMM: add mirror fault support for system to device memory migration v3. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 09/14] HMM: allow to get pointer to spinlock protecting a directory. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 04/14] HMM: add new HMM page table flag (select flag). Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 13/14] HMM: CPU page fault on migrated memory. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 10/14] HMM: split DMA mapping function in two. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 12/14] HMM: fork copy migrated memory into system memory for child process. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:20 +0200
  [PATCH v11 08/14] HMM: new callback for copying memory from and to device memory v2. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:30 +0200
  [PATCH v11 01/14] fork: pass the dst vma to copy_page_range() and its sub-functions. Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:30 +0200
  [PATCH v11 03/14] HMM: add new HMM page table flag (valid device memory). Jérôme Glisse <jglisse@redhat.com> - 2015-10-21 22:30 +0200

csiph-web