mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mempool: add unlikely and likely hints
Add unlikely and likely hints to the function mempool_free. It lays out the code in such a way that the common path is executed straighforward and saves a cache line. Signed-off-by: Mikulas Patocka <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
da1c67a76f
commit
eb9a3c62a0
1 changed files with 2 additions and 2 deletions
|
|
@ -304,9 +304,9 @@ void mempool_free(void *element, mempool_t *pool)
|
|||
* ensures that there will be frees which return elements to the
|
||||
* pool waking up the waiters.
|
||||
*/
|
||||
if (pool->curr_nr < pool->min_nr) {
|
||||
if (unlikely(pool->curr_nr < pool->min_nr)) {
|
||||
spin_lock_irqsave(&pool->lock, flags);
|
||||
if (pool->curr_nr < pool->min_nr) {
|
||||
if (likely(pool->curr_nr < pool->min_nr)) {
|
||||
add_element(pool, element);
|
||||
spin_unlock_irqrestore(&pool->lock, flags);
|
||||
wake_up(&pool->wait);
|
||||
|
|
|
|||
Loading…
Reference in a new issue