diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debugobjects.c | 11 | ||||
-rw-r--r-- | lib/list_debug.c | 22 |
2 files changed, 27 insertions, 6 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 0ab9ae8057f0..d11808ca4bc4 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -79,30 +79,29 @@ static const char *obj_states[ODEBUG_STATE_MAX] = { | |||
79 | [ODEBUG_STATE_NOTAVAILABLE] = "not available", | 79 | [ODEBUG_STATE_NOTAVAILABLE] = "not available", |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static int fill_pool(void) | 82 | static void fill_pool(void) |
83 | { | 83 | { |
84 | gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; | 84 | gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; |
85 | struct debug_obj *new; | 85 | struct debug_obj *new; |
86 | unsigned long flags; | 86 | unsigned long flags; |
87 | 87 | ||
88 | if (likely(obj_pool_free >= ODEBUG_POOL_MIN_LEVEL)) | 88 | if (likely(obj_pool_free >= ODEBUG_POOL_MIN_LEVEL)) |
89 | return obj_pool_free; | 89 | return; |
90 | 90 | ||
91 | if (unlikely(!obj_cache)) | 91 | if (unlikely(!obj_cache)) |
92 | return obj_pool_free; | 92 | return; |
93 | 93 | ||
94 | while (obj_pool_free < ODEBUG_POOL_MIN_LEVEL) { | 94 | while (obj_pool_free < ODEBUG_POOL_MIN_LEVEL) { |
95 | 95 | ||
96 | new = kmem_cache_zalloc(obj_cache, gfp); | 96 | new = kmem_cache_zalloc(obj_cache, gfp); |
97 | if (!new) | 97 | if (!new) |
98 | return obj_pool_free; | 98 | return; |
99 | 99 | ||
100 | raw_spin_lock_irqsave(&pool_lock, flags); | 100 | raw_spin_lock_irqsave(&pool_lock, flags); |
101 | hlist_add_head(&new->node, &obj_pool); | 101 | hlist_add_head(&new->node, &obj_pool); |
102 | obj_pool_free++; | 102 | obj_pool_free++; |
103 | raw_spin_unlock_irqrestore(&pool_lock, flags); | 103 | raw_spin_unlock_irqrestore(&pool_lock, flags); |
104 | } | 104 | } |
105 | return obj_pool_free; | ||
106 | } | 105 | } |
107 | 106 | ||
108 | /* | 107 | /* |
@@ -1052,10 +1051,10 @@ static int __init debug_objects_replace_static_objects(void) | |||
1052 | cnt++; | 1051 | cnt++; |
1053 | } | 1052 | } |
1054 | } | 1053 | } |
1054 | local_irq_enable(); | ||
1055 | 1055 | ||
1056 | printk(KERN_DEBUG "ODEBUG: %d of %d active objects replaced\n", cnt, | 1056 | printk(KERN_DEBUG "ODEBUG: %d of %d active objects replaced\n", cnt, |
1057 | obj_pool_used); | 1057 | obj_pool_used); |
1058 | local_irq_enable(); | ||
1059 | return 0; | 1058 | return 0; |
1060 | free: | 1059 | free: |
1061 | hlist_for_each_entry_safe(obj, node, tmp, &objects, node) { | 1060 | hlist_for_each_entry_safe(obj, node, tmp, &objects, node) { |
diff --git a/lib/list_debug.c b/lib/list_debug.c index 982b850d4e7a..3810b481f940 100644 --- a/lib/list_debug.c +++ b/lib/list_debug.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/list.h> | 10 | #include <linux/list.h> |
11 | #include <linux/bug.h> | 11 | #include <linux/bug.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/rculist.h> | ||
13 | 14 | ||
14 | /* | 15 | /* |
15 | * Insert a new entry between two known consecutive entries. | 16 | * Insert a new entry between two known consecutive entries. |
@@ -75,3 +76,24 @@ void list_del(struct list_head *entry) | |||
75 | entry->prev = LIST_POISON2; | 76 | entry->prev = LIST_POISON2; |
76 | } | 77 | } |
77 | EXPORT_SYMBOL(list_del); | 78 | EXPORT_SYMBOL(list_del); |
79 | |||
80 | /* | ||
81 | * RCU variants. | ||
82 | */ | ||
83 | void __list_add_rcu(struct list_head *new, | ||
84 | struct list_head *prev, struct list_head *next) | ||
85 | { | ||
86 | WARN(next->prev != prev, | ||
87 | "list_add_rcu corruption. next->prev should be " | ||
88 | "prev (%p), but was %p. (next=%p).\n", | ||
89 | prev, next->prev, next); | ||
90 | WARN(prev->next != next, | ||
91 | "list_add_rcu corruption. prev->next should be " | ||
92 | "next (%p), but was %p. (prev=%p).\n", | ||
93 | next, prev->next, prev); | ||
94 | new->next = next; | ||
95 | new->prev = prev; | ||
96 | rcu_assign_pointer(list_next_rcu(prev), new); | ||
97 | next->prev = new; | ||
98 | } | ||
99 | EXPORT_SYMBOL(__list_add_rcu); | ||