diff options
author | Jérôme Glisse <jglisse@redhat.com> | 2015-05-15 08:17:28 -0400 |
---|---|---|
committer | Jérôme Glisse <jglisse@redhat.com> | 2015-08-10 11:15:13 -0400 |
commit | ce49c05b539245f7b1c5cf496242a39817bd67b7 (patch) | |
tree | 326fffb522f734f0d3e769b48a281e8ffc785a81 | |
parent | 73e58f73d8f1a4d5e6af31c2f9171f402da014b7 (diff) |
HMM: allow to get pointer to spinlock protecting a directory.
Several use case for getting pointer to spinlock protecting a directory.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
-rw-r--r-- | include/linux/hmm_pt.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/hmm_pt.h b/include/linux/hmm_pt.h index f745d6c319dc..22100a6c3aa6 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; |