git: c84bd1f28711 - stable/13 - linuxkpi: Add trylock_page and unlock_page

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 07 Sep 2022 15:10:15 UTC
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=c84bd1f287110d7ef9751a29116a4459b7749524

commit c84bd1f287110d7ef9751a29116a4459b7749524
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-08-02 07:33:47 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-09-07 15:09:04 +0000

    linuxkpi: Add trylock_page and unlock_page
    
    Simple wrapper around vm_page_trylock and vm_page_unlock.
    
    Reviewed by:    hselasky
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D36019
    
    (cherry picked from commit d1c3cfd79da148755ef0fa51f65cd8d0d64b9a88)
---
 sys/compat/linuxkpi/common/include/linux/mm.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index 4d4c189e2939..d2db343fc094 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -288,6 +288,19 @@ vmalloc_to_page(const void *addr)
 	return (PHYS_TO_VM_PAGE(paddr));
 }
 
+static inline int
+trylock_page(struct page *page)
+{
+	return (vm_page_trylock(page));
+}
+
+static inline void
+unlock_page(struct page *page)
+{
+
+	vm_page_unlock(page);
+}
+
 extern int is_vmalloc_addr(const void *addr);
 void si_meminfo(struct sysinfo *si);