diff mbox series

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

Message ID 20221027042651.234524-10-senozhatsky@chromium.org (mailing list archive)
State New
Headers show
Series zsmalloc/zram: configurable zspage size | expand

Commit Message

Sergey Senozhatsky Oct. 27, 2022, 4:26 a.m. UTC
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 mbox series

Patch

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 7465a45495bf..0bc9ed1f1a5d 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -787,6 +787,9 @@  static int get_pages_per_zspage(u32 class_size, u32 max_pages_per_zspage)
 			max_usedpc = usedpc;
 			max_usedpc_order = i;
 		}
+
+		if (usedpc == 100)
+			break;
 	}
 
 	return max_usedpc_order;