lkml.org 
[lkml]   [2023]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 2/2] zsmalloc: check empty page in find_alloced_obj
Date
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
\
 
 \ /
  Last update: 2023-06-19 16:36    [W:0.060 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site