kernel: mem_slab: Reschedule in k_mem_slab_free only when necessary.

Rescheduling was called unconditionally at the end of k_mem_slab_free
call. It is necessary only when thread is pending in the wait queue.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-05-18 08:08:50 +02:00 committed by Anas Nashif
commit 9666c30d5f

View file

@ -120,11 +120,11 @@ void k_mem_slab_free(struct k_mem_slab *slab, void **mem)
if (pending_thread) { if (pending_thread) {
_set_thread_return_value_with_data(pending_thread, 0, *mem); _set_thread_return_value_with_data(pending_thread, 0, *mem);
_ready_thread(pending_thread); _ready_thread(pending_thread);
_reschedule(key);
} else { } else {
**(char ***)mem = slab->free_list; **(char ***)mem = slab->free_list;
slab->free_list = *(char **)mem; slab->free_list = *(char **)mem;
slab->num_used--; slab->num_used--;
irq_unlock(key);
} }
_reschedule(key);
} }