Messages in this thread Patch in this message | | | From | Alexey Romanov <> | Subject | [PATCH v1 2/2] zsmalloc: check empty page in find_alloced_obj | Date | Mon, 19 Jun 2023 17:35:06 +0300 |
| |
It makes no sense to search for an allocated object if there are none on the page. Using this check, we get rid of the extra kmap_atomic, as well as the search for a tagged object. On my synthetic test data, this change speed up zsmalloc compaction time by up to 10%.
Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru> --- mm/zsmalloc.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index dd6e2c3429e0..d0ce579dcde5 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1764,6 +1764,9 @@ static unsigned long find_tagged_obj(struct size_class *class, static unsigned long find_alloced_obj(struct size_class *class, struct page *page, int *obj_idx) { + if (!get_obj_allocated(page)) + return 0; + return find_tagged_obj(class, page, obj_idx, OBJ_ALLOCATED_TAG); } -- 2.38.1
| |