Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1576914
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 10/10] kasan, sched/headers: Uninline kasan_enable/disable_current() |
| Date | 2017-02-08 20:10 +0100 |
| Message-ID | <t8FMU-4eP-71@gated-at.bofh.it> (permalink) |
| References | <t8FjQ-3Oi-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
<linux/kasan.h> is a low level header that is included early
in affected kernel headers. But it includes <linux/sched.h>
which complicates the cleanup of sched.h dependencies.
But kasan.h has almost no need for sched.h: its only use of
scheduler functionality is in two inline functions which are
not used very frequently - so uninline kasan_enable_current()
and kasan_disable_current().
Also add a <linux/sched.h> dependency to a .c file that depended
on kasan.h including it.
This paves the way to remove the <linux/sched.h> include from kasan.h.
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/kasan.h | 10 ++--------
lib/sbitmap.c | 1 +
mm/kasan/kasan.c | 10 ++++++++++
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 820c0ad54a01..96ef4c33148d 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -30,16 +30,10 @@ static inline void *kasan_mem_to_shadow(const void *addr)
}
/* Enable reporting bugs after kasan_disable_current() */
-static inline void kasan_enable_current(void)
-{
- current->kasan_depth++;
-}
+extern void kasan_enable_current(void);
/* Disable reporting bugs for current task */
-static inline void kasan_disable_current(void)
-{
- current->kasan_depth--;
-}
+extern void kasan_disable_current(void);
void kasan_unpoison_shadow(const void *address, size_t size);
diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index 2cecf05c82fd..8641ca20a4f0 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+#include <linux/sched.h>
#include <linux/random.h>
#include <linux/sbitmap.h>
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index b2a0cff2bb35..37d39f7f6260 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -39,6 +39,16 @@
#include "kasan.h"
#include "../slab.h"
+void kasan_enable_current(void)
+{
+ current->kasan_depth++;
+}
+
+void kasan_disable_current(void)
+{
+ current->kasan_depth--;
+}
+
/*
* Poisons the shadow memory for 'size' bytes starting from 'addr'.
* Memory addresses should be aligned to KASAN_SHADOW_SCALE_SIZE.
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/10] sched.h modernization -v2, phase #1: "Pre-splitup cleanups" Ingo Molnar <mingo@kernel.org> - 2017-02-08 19:40 +0100
[PATCH 06/10] sched/core: Remove the tsk_nr_cpus_allowed() wrapper Ingo Molnar <mingo@kernel.org> - 2017-02-08 19:40 +0100
[PATCH 01/10] sched/headers: Make all include/linux/sched/*.h headers build standalone Ingo Molnar <mingo@kernel.org> - 2017-02-08 19:40 +0100
[PATCH 03/10] sched/headers: Make task_struct::wake_q an opaque pointer Ingo Molnar <mingo@kernel.org> - 2017-02-08 19:40 +0100
Re: [PATCH 03/10] sched/headers: Make task_struct::wake_q an opaque pointer Linus Torvalds <torvalds@linux-foundation.org> - 2017-02-08 21:10 +0100
[PATCH] sched/wake_q: Restore task_struct::wake_q type safety Ingo Molnar <mingo@kernel.org> - 2017-02-08 22:40 +0100
[PATCH 08/10] sched/headers, cgroups: Remove the threadgroup_change_*() wrappery Ingo Molnar <mingo@kernel.org> - 2017-02-08 19:50 +0100
[PATCH 10/10] kasan, sched/headers: Uninline kasan_enable/disable_current() Ingo Molnar <mingo@kernel.org> - 2017-02-08 20:10 +0100
[PATCH 09/10] mm/vmacache, sched/headers: Introduce 'struct vmacache' and move it from <linux/sched.h> to <linux/mm_types> Ingo Molnar <mingo@kernel.org> - 2017-02-08 20:50 +0100
[PATCH 07/10] rcu: Separate the RCU synchronization types and APIs into <linux/rcupdate_wait.h> Ingo Molnar <mingo@kernel.org> - 2017-02-08 20:50 +0100
Re: [PATCH 07/10] rcu: Separate the RCU synchronization types and APIs into <linux/rcupdate_wait.h> Paul McKenney <paulmckrcu@gmail.com> - 2017-02-11 20:20 +0100
Re: [PATCH 00/10] sched.h modernization -v2, phase #1: "Pre-splitup cleanups" Linus Torvalds <torvalds@linux-foundation.org> - 2017-02-08 21:30 +0100
csiph-web