summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/uaccess.h30
-rw-r--r--mm/memory.c2
2 files changed, 30 insertions, 2 deletions
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 9414a1b..44b3751 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -8,8 +8,34 @@
* These routines enable/disable the pagefault handler in that
* it will not take any MM locks and go straight to the fixup table.
*/
+static inline void raw_pagefault_disable(void)
+{
+ inc_preempt_count();
+ barrier();
+}
+
+static inline void raw_pagefault_enable(void)
+{
+ barrier();
+ dec_preempt_count();
+ barrier();
+ preempt_check_resched();
+}
+
+#ifndef CONFIG_PREEMPT_RT_FULL
+static inline void pagefault_disable(void)
+{
+ raw_pagefault_disable();
+}
+
+static inline void pagefault_enable(void)
+{
+ raw_pagefault_enable();
+}
+#else
extern void pagefault_disable(void);
extern void pagefault_enable(void);
+#endif
#ifndef ARCH_HAS_NOCACHE_UACCESS
@@ -50,9 +76,9 @@ static inline unsigned long __copy_from_user_nocache(void *to,
mm_segment_t old_fs = get_fs(); \
\
set_fs(KERNEL_DS); \
- pagefault_disable(); \
+ raw_pagefault_disable(); \
ret = __copy_from_user_inatomic(&(retval), (__force typeof(retval) __user *)(addr), sizeof(retval)); \
- pagefault_enable(); \
+ raw_pagefault_enable(); \
set_fs(old_fs); \
ret; \
})
diff --git a/mm/memory.c b/mm/memory.c
index 7ad7e6d..efe0d86 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3742,6 +3742,7 @@ unlock:
return 0;
}
+#ifdef CONFIG_PREEMPT_RT_FULL
void pagefault_disable(void)
{
inc_preempt_count();
@@ -3770,6 +3771,7 @@ void pagefault_enable(void)
preempt_check_resched();
}
EXPORT_SYMBOL(pagefault_enable);
+#endif
/*
* By the time we get here, we already hold the mm semaphore