Skip to contentSkip to conversation

mm/zbud: use list_last_entry in zbud_reclaim_page() directly

PATCH In review Jeff Liu 2 participants 2 messages Jan 15, 2014 Memory management

lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH 1/1 mm/zbud: use list_last_entry in zbud_reclaim_page() directly

From: Jie Liu <[email protected]>

Get rid of the self defined list_tail_entry() helper and use list_last_entry() in zbud_reclaim_page() directly.

---
 mm/zbud.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
mm/zbud.c +1 -4
index 9451361..8ac1e97 100644
@@ -360,9 +360,6 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle)
 	spin_unlock(&pool->lock);
 }
 
-#define list_tail_entry(ptr, type, member) \
-	list_entry((ptr)->prev, type, member)
-
 /**
  * zbud_reclaim_page() - evicts allocations from a pool page and frees it
  * @pool:	pool from which a page will attempt to be evicted
@@ -411,7 +408,7 @@ int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries)
 		return -EINVAL;
 	}
 	for (i = 0; i < retries; i++) {
-		zhdr = list_tail_entry(&pool->lru, struct zbud_header, lru);
+		zhdr = list_last_entry(&pool->lru, struct zbud_header, lru);
 		list_del(&zhdr->lru);
 		list_del(&zhdr->buddy);
 		/* Protect zbud page against free */
Signature · 7 lines
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jeff Liu

From: Jie Liu <[email protected]>

Get rid of the self defined list_tail_entry() helper and use list_last_entry() in zbud_reclaim_page() directly.

Good find :)

Quoted 35 lines
---
 mm/zbud.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
mm/zbud.c +1 -4
index 9451361..8ac1e97 100644
@@ -360,9 +360,6 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle)
 	spin_unlock(&pool->lock);
 }
 
-#define list_tail_entry(ptr, type, member) \
-	list_entry((ptr)->prev, type, member)
-
 /**
  * zbud_reclaim_page() - evicts allocations from a pool page and frees it
  * @pool:	pool from which a page will attempt to be evicted
@@ -411,7 +408,7 @@ int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries)
 		return -EINVAL;
 	}
 	for (i = 0; i < retries; i++) {
-		zhdr = list_tail_entry(&pool->lru, struct zbud_header, lru);
+		zhdr = list_last_entry(&pool->lru, struct zbud_header, lru);
 		list_del(&zhdr->lru);
 		list_del(&zhdr->buddy);
 		/* Protect zbud page against free */
Signature · 7 lines
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>