[PATCHv4 9/9] zsmalloc: break out of loop when found perfect zspage order

Sergey Senozhatsky
2022-10-31T05:42:22Z

If we found zspage configuration that gives us perfect
100% used percentage (zero wasted space) then there is
no point it trying any other configuration

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
mm/zsmalloc.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 42987a913f45..a40c548520d3 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -787,6 +787,9 @@ static int get_pages_per_zspage(u32 class_size, u32 num_pages)
max_usedpc = usedpc;
max_usedpc_order = i;
}
+
+ if (usedpc == 100)
+ break;
}

return max_usedpc_order;
--
2.38.1.273.g43a17bfeac-goog