Skip to contentSkip to conversation

+ mempool-add-unlikely-and-likely-hints.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Mar 7, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mempool-add-unlikely-and-likely-hints.patch added to -mm tree
To: [email protected],[email protected]
From: [email protected]
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 <[email protected]>
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.

---

 mm/mempool.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/mempool.c renamed from mm/mempool.c~mempool-add-unlikely-and-likely-hints +2 -2
diff -puN mm/mempool.c~mempool-add-unlikely-and-likely-hints 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 [email protected] are

mempool-add-unlikely-and-likely-hints.patch
linux-next.patch