Subject: + mempool-add-unlikely-and-likely-hints.patch added to -mm tree To: mpatocka@xxxxxxxxxx,mingo@xxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Fri, 07 Mar 2014 14:58:35 -0800 The patch titled Subject: mempool: add unlikely and likely hints has been added to the -mm tree. Its filename is mempool-add-unlikely-and-likely-hints.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mempool-add-unlikely-and-likely-hints.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mempool-add-unlikely-and-likely-hints.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mikulas Patocka <mpatocka@xxxxxxxxxx> Subject: 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 <mpatocka@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN mm/mempool.c~mempool-add-unlikely-and-likely-hints mm/mempool.c --- a/mm/mempool.c~mempool-add-unlikely-and-likely-hints +++ a/mm/mempool.c @@ -304,9 +304,9 @@ void mempool_free(void *element, mempool * 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); _ Patches currently in -mm which might be from mpatocka@xxxxxxxxxx are mempool-add-unlikely-and-likely-hints.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html