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:
parent
7393cb2478
commit
9666c30d5f
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue