Skip to content

Commit 91a4ee2

Browse files
aarcange-rhtorvalds
authored andcommitted
thp: add pmd mmu_notifier helpers
Add mmu notifier helpers to handle pmd huge operations. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8ac1f83 commit 91a4ee2

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎include/linux/mmu_notifier.h‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,32 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
243243
__pte; \
244244
})
245245

246+
#define pmdp_clear_flush_notify(__vma, __address, __pmdp) \
247+
({ \
248+
pmd_t __pmd; \
249+
struct vm_area_struct *___vma = __vma; \
250+
unsigned long ___address = __address; \
251+
VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
252+
mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
253+
(__address)+HPAGE_PMD_SIZE);\
254+
__pmd = pmdp_clear_flush(___vma, ___address, __pmdp); \
255+
mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
256+
(__address)+HPAGE_PMD_SIZE); \
257+
__pmd; \
258+
})
259+
260+
#define pmdp_splitting_flush_notify(__vma, __address, __pmdp) \
261+
({ \
262+
struct vm_area_struct *___vma = __vma; \
263+
unsigned long ___address = __address; \
264+
VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
265+
mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
266+
(__address)+HPAGE_PMD_SIZE);\
267+
pmdp_splitting_flush(___vma, ___address, __pmdp); \
268+
mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
269+
(__address)+HPAGE_PMD_SIZE); \
270+
})
271+
246272
#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
247273
({ \
248274
int __young; \
@@ -254,6 +280,17 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
254280
__young; \
255281
})
256282

283+
#define pmdp_clear_flush_young_notify(__vma, __address, __pmdp) \
284+
({ \
285+
int __young; \
286+
struct vm_area_struct *___vma = __vma; \
287+
unsigned long ___address = __address; \
288+
__young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
289+
__young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
290+
___address); \
291+
__young; \
292+
})
293+
257294
#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
258295
({ \
259296
struct mm_struct *___mm = __mm; \
@@ -305,7 +342,10 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
305342
}
306343

307344
#define ptep_clear_flush_young_notify ptep_clear_flush_young
345+
#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
308346
#define ptep_clear_flush_notify ptep_clear_flush
347+
#define pmdp_clear_flush_notify pmdp_clear_flush
348+
#define pmdp_splitting_flush_notify pmdp_splitting_flush
309349
#define set_pte_at_notify set_pte_at
310350

311351
#endif /* CONFIG_MMU_NOTIFIER */

0 commit comments

Comments
 (0)