z3fold: avoid modifying HEADLESS page and minor cleanup
PATCH 1/1 z3fold: avoid modifying HEADLESS page and minor cleanup
This patch fixes erroneous z3fold header access in a HEADLESS page in reclaim function, and changes one remaining direct handle-to-buddy conversion to use the appropriate helper.
Signed-off-by Vitaly Wool <[email protected]>
--- mm/z3fold.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
mm/z3fold.c +14 -10
@@ -412,7 +412,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle)/* HEADLESS page stored */ bud =HEADLESS ; }else { - bud = (handle - zhdr->first_num) &BUDDY_MASK ; + bud =handle_to_buddy (handle);switch (bud) {case FIRST :
@@ -572,15 +572,19 @@ next: pool->pages_nr--;spin_unlock (&pool->lock);return 0 ; - }else if (zhdr->first_chunks !=0 && - zhdr->last_chunks !=0 && zhdr->middle_chunks !=0 ) { -/* Full, add to buddied list */ -list_add (&zhdr->buddy, &pool->buddied); - }else if (!test_bit (PAGE_HEADLESS , &page->private)) { -z3fold_compact_page (zhdr); -/* add to unbuddied list */ - freechunks =num_free_chunks (zhdr); -list_add (&zhdr->buddy, &pool->unbuddied[freechunks]); + }else if (!test_bit (PAGE_HEADLESS , &page->private)) { +if (zhdr->first_chunks !=0 && + zhdr->last_chunks !=0 && + zhdr->middle_chunks !=0 ) { +/* Full, add to buddied list */ +list_add (&zhdr->buddy, &pool->buddied); + }else { +z3fold_compact_page (zhdr); +/* add to unbuddied list */ + freechunks =num_free_chunks (zhdr); +list_add (&zhdr->buddy, + &pool->unbuddied[freechunks]); + } }/* add to beginning of LRU */
Signature · 7 lines
2.5.0 -- 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 5 lines · Vitaly Wool
This patch fixes erroneous z3fold header access in a HEADLESS page in reclaim function, and changes one remaining direct handle-to-buddy conversion to use the appropriate helper.
Signed-off-by Vitaly Wool <[email protected]>
Reviewed-by Dan Streetman <[email protected]>
Quoted 47 lines
--- mm/z3fold.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)mm/z3fold.c +14
-10@@ -412,7 +412,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle)/* HEADLESS page stored */ bud =HEADLESS ; }else { - bud = (handle - zhdr->first_num) &BUDDY_MASK ; + bud =handle_to_buddy (handle);switch (bud) {case FIRST :@@ -572,15 +572,19 @@ next: pool->pages_nr--;spin_unlock (&pool->lock);return 0 ; - }else if (zhdr->first_chunks !=0 && - zhdr->last_chunks !=0 && zhdr->middle_chunks != 0) { -/* Full, add to buddied list */ -list_add (&zhdr->buddy, &pool->buddied); - }else if (!test_bit (PAGE_HEADLESS , &page->private)) { -z3fold_compact_page (zhdr); -/* add to unbuddied list */ - freechunks =num_free_chunks (zhdr); -list_add (&zhdr->buddy, &pool->unbuddied[freechunks]); + } else if (!test_bit(PAGE_HEADLESS, &page->private)) { +if (zhdr->first_chunks !=0 && + zhdr->last_chunks !=0 && + zhdr->middle_chunks !=0 ) { +/* Full, add to buddied list */ +list_add (&zhdr->buddy, &pool->buddied); + }else { +z3fold_compact_page (zhdr); +/* add to unbuddied list */ + freechunks =num_free_chunks (zhdr); +list_add (&zhdr->buddy, + &pool->unbuddied[freechunks]); + } }/* add to beginning of LRU */
Quoted 3 lines
--
2.5.0
--
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>