summaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-02-15 13:33:59 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 12:59:02 -0400
commitdcc5d337c5e62761ee71f2e25c7aa890b1aa41a2 (patch)
treef77619f9b0067bf4e52f69cf586659ba2cdd4c2e /mm/internal.h
parente83c09a24e3d229f84163c119224af4c8f6c54c1 (diff)
downloadlinux-dcc5d337c5e62761ee71f2e25c7aa890b1aa41a2.tar.bz2
mm/mlock: Add mlock_vma_folio()
Convert mlock_page() into mlock_folio() and convert the callers. Keep mlock_vma_page() as a wrapper. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/mm/internal.h b/mm/internal.h
index 3b652444f070..6039acc780c0 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -416,8 +416,8 @@ extern int mlock_future_check(struct mm_struct *mm, unsigned long flags,
* pte mappings of THPs, which cannot be consistently counted: a pte
* mapping of the THP head cannot be distinguished by the page alone.
*/
-void mlock_page(struct page *page);
-static inline void mlock_vma_page(struct page *page,
+void mlock_folio(struct folio *folio);
+static inline void mlock_vma_folio(struct folio *folio,
struct vm_area_struct *vma, bool compound)
{
/*
@@ -429,9 +429,16 @@ static inline void mlock_vma_page(struct page *page,
* still be set while VM_SPECIAL bits are added: so ignore it then.
*/
if (unlikely((vma->vm_flags & (VM_LOCKED|VM_SPECIAL)) == VM_LOCKED) &&
- (compound || !PageTransCompound(page)))
- mlock_page(page);
+ (compound || !folio_test_large(folio)))
+ mlock_folio(folio);
+}
+
+static inline void mlock_vma_page(struct page *page,
+ struct vm_area_struct *vma, bool compound)
+{
+ mlock_vma_folio(page_folio(page), vma, compound);
}
+
void munlock_page(struct page *page);
static inline void munlock_vma_page(struct page *page,
struct vm_area_struct *vma, bool compound)