mm: reposition zbud page in lru list if not freed in zbud_free
PATCH 1/1 mm: reposition zbud page in lru list if not freed in zbud_free
Reposition zbud page in the lru list of the pool if the zbud page is not freed in zbud_free.
--- mm/zbud.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/zbud.c +2 -1
@@ -432,15 +432,16 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle)/* Remove from existing buddy list */ list_del (&zhdr->buddy); +list_del (&zhdr->lru);if (zhdr->first_chunks ==0 && zhdr->last_chunks ==0 ) {/* zbud page is empty, free */ -list_del (&zhdr->lru);free_zbud_page (zhdr); pool->pages_nr--; }else {/* Add to unbuddied list */ freechunks =num_free_chunks (zhdr);list_add (&zhdr->buddy, &pool->unbuddied[freechunks]); +list_add (&zhdr->lru, &pool->lru); }spin_unlock (&pool->lock);
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>
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Seth Jennings
Quoted 2 lines · Wang Sheng-Hui
Reposition zbud page in the lru list of the pool if the zbud page is not freed in
zbud_free.This doesn't mention what is wrong with the current code. Afaict, the code is doing the right thing by not changing the position of the zpage in the LRU. Why would we want to move a zpage to the front of the LRU just because one of the allocations it contains is freed? The "age" of the other allocation is unchanged and its containing zpage should maintain its position in the LRU, right?
Thanks for your explanation, Seth!
Regards,
Sheng-Hui
Quoted 30 lines
Thanks,
SethQuoted 27 lines
Signed-off-by Wang Sheng-Hui <[email protected]>--- mm/zbud.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)mm/zbud.c +2
-1@@ -432,15 +432,16 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle)/* Remove from existing buddy list */ list_del (&zhdr->buddy); +list_del (&zhdr->lru);if (zhdr->first_chunks ==0 && zhdr->last_chunks ==0 ) {/* zbud page is empty, free */ -list_del (&zhdr->lru);free_zbud_page (zhdr); pool->pages_nr--; }else {/* Add to unbuddied list */ freechunks =num_free_chunks (zhdr);list_add (&zhdr->buddy, &pool->unbuddied[freechunks]); +list_add (&zhdr->lru, &pool->lru); }
Quoted 4 lines
Quoted 4 lines
mm/zbud.c +0
-0spin_unlock (&pool->lock);Signature · 1 line
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>
Quoted 11 lines · Seth Jennings
Quoted 2 lines · Wang Sheng-Hui
Reposition zbud page in the lru list of the pool if the zbud page is not freed in
zbud_free.This doesn't mention what is wrong with the current code. Afaict, the code is doing the right thing by not changing the position of the zpage in the LRU. Why would we want to move a zpage to the front of the LRU just because one of the allocations it contains is freed? The "age" of the other allocation is unchanged and its containing zpage should maintain its position in the LRU, right?
Seth,
I have one question.
In zbud_reclaim_page, if one page contains handles not freed, then the page is repositioned, in current code.
540 } else if (zhdr->first_chunks == 0 ||
541 zhdr->last_chunks == 0) {
542 /* add to unbuddied list */ 543 freechunks = num_free_chunks(zhdr); 544 list_add(&zhdr->buddy, &pool->unbuddied[freechunks]);
545 } else {
546 /* add to buddied list */
547 list_add(&zhdr->buddy, &pool->buddied);
548 }
549
550 /* add to beginning of LRU */
551 list_add(&zhdr->lru, &pool->lru);
I want to why it is different for zbud_free?
Regards,
Sheng-Hui
Quoted 30 lines
Thanks,
SethQuoted 27 lines
Signed-off-by Wang Sheng-Hui <[email protected]>--- mm/zbud.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)mm/zbud.c +2
-1@@ -432,15 +432,16 @@ void zbud_free(struct zbud_pool *pool, unsigned long handle)/* Remove from existing buddy list */ list_del (&zhdr->buddy); +list_del (&zhdr->lru);if (zhdr->first_chunks ==0 && zhdr->last_chunks ==0 ) {/* zbud page is empty, free */ -list_del (&zhdr->lru);free_zbud_page (zhdr); pool->pages_nr--; }else {/* Add to unbuddied list */ freechunks =num_free_chunks (zhdr);list_add (&zhdr->buddy, &pool->unbuddied[freechunks]); +list_add (&zhdr->lru, &pool->lru); }
Quoted 4 lines
Quoted 4 lines
mm/zbud.c +0
-0spin_unlock (&pool->lock);Signature · 1 line
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>