Skip to contentSkip to conversation

kasan: Make it RT aware

PATCH New Mike Galbraith 1 participant 1 message Aug 21, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kasan: Make it RT aware

Skip preallocation when not possible for RT, and move cache removal from IPI, where freeing is not possible for RT, to synchronous work.

---
 lib/stackdepot.c      |    4 ++--
 mm/kasan/quarantine.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)
lib/stackdepot.c +2 -2
@@ -265,7 +265,7 @@ depot_stack_handle_t stack_depot_save(un
 	struct page *page = NULL;
 	void *prealloc = NULL;
 	unsigned long flags;
-	u32 hash;
+	u32 hash, may_prealloc = !IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible();
 
 	if (unlikely(nr_entries == 0) || stack_depot_disable)
 		goto fast_exit;
@@ -291,7 +291,7 @@ depot_stack_handle_t stack_depot_save(un
 	 * The smp_load_acquire() here pairs with smp_store_release() to
 	 * |next_slab_inited| in depot_alloc_stack() and init_stack_slab().
 	 */
-	if (unlikely(!smp_load_acquire(&next_slab_inited))) {
+	if (unlikely(!smp_load_acquire(&next_slab_inited) && may_prealloc)) {
 		/*
 		 * Zero out zone modifiers, as we don't have specific zone
 		 * requirements. Keep the flags related to allocation in atomic
mm/kasan/quarantine.c +49 -0

68 lines not on this page · raw message