]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
uaccess: Define pagefault lock guard
authorViktor Malik <vmalik@redhat.com>
Thu, 26 Jun 2025 06:08:28 +0000 (08:08 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 26 Jun 2025 16:44:45 +0000 (09:44 -0700)
Define a pagefault lock guard which allows to simplify functions that
need to disable page faults.

Signed-off-by: Viktor Malik <vmalik@redhat.com>
Link: https://lore.kernel.org/r/8a01beb0b671923976f08297d81242bb2129881d.1750917800.git.vmalik@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/uaccess.h

index 7c06f4795670466ba3b8213e14976fe996303663..1beb5b395d81d7103f48b53bc8928db739b266cc 100644 (file)
@@ -296,6 +296,8 @@ static inline bool pagefault_disabled(void)
  */
 #define faulthandler_disabled() (pagefault_disabled() || in_atomic())
 
+DEFINE_LOCK_GUARD_0(pagefault, pagefault_disable(), pagefault_enable())
+
 #ifndef CONFIG_ARCH_HAS_SUBPAGE_FAULTS
 
 /**