debugobject: Ensure pool refill (again)
[linux-2.6-microblaze.git] / lib / debugobjects.c
index b796799..003edc5 100644 (file)
@@ -587,6 +587,16 @@ static struct debug_obj *lookup_object_or_alloc(void *addr, struct debug_bucket
        return NULL;
 }
 
+static void debug_objects_fill_pool(void)
+{
+       /*
+        * On RT enabled kernels the pool refill must happen in preemptible
+        * context:
+        */
+       if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
+               fill_pool();
+}
+
 static void
 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack)
 {
@@ -595,12 +605,7 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack
        struct debug_obj *obj;
        unsigned long flags;
 
-       /*
-        * On RT enabled kernels the pool refill must happen in preemptible
-        * context:
-        */
-       if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
-               fill_pool();
+       debug_objects_fill_pool();
 
        db = get_bucket((unsigned long) addr);
 
@@ -685,6 +690,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr)
        if (!debug_objects_enabled)
                return 0;
 
+       debug_objects_fill_pool();
+
        db = get_bucket((unsigned long) addr);
 
        raw_spin_lock_irqsave(&db->lock, flags);
@@ -894,6 +901,8 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr)
        if (!debug_objects_enabled)
                return;
 
+       debug_objects_fill_pool();
+
        db = get_bucket((unsigned long) addr);
 
        raw_spin_lock_irqsave(&db->lock, flags);