[v6,6/6] zsmalloc: Implement writeback mechanism for zsmalloc (fix)

Message ID 20221123191703.2902079-3-nphamcs@gmail.com
State New
Headers
Series Implement writeback for zsmalloc (fix) |

Commit Message

Nhat Pham Nov. 23, 2022, 7:17 p.m. UTC
  Use get_first_page(), and add cond_resched() in retry loop.

Signed-off-by: Nhat Pham <nphamcs@gmail.com>
Suggested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 mm/zsmalloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.30.2
  

Patch

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index e2bd41f37b5b..ab4fa17a0fad 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2488,12 +2488,13 @@  static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries)
 		remove_zspage(class, zspage, fullness);

 		spin_unlock(&pool->lock);
+		cond_resched();

 		/* Lock backing pages into place */
 		lock_zspage(zspage);

 		obj_idx = 0;
-		page = zspage->first_page;
+		page = get_first_page(zspage);
 		while (1) {
 			handle = find_alloced_obj(class, page, &obj_idx);
 			if (!handle) {