Use get_first_page(), and add cond_resched() in retry loop.
Signed-off-by: Nhat Pham <[email protected]>
Suggested-by: Sergey Senozhatsky <[email protected]>
---
mm/zsmalloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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) {
--
2.30.2