Skip to contentSkip to conversation

zsmalloc: consider ZS_ALMOST_FULL as migrate source

PATCH In review Minchan Kim 2 participants 3 messages Jul 10, 2015

Subsystems (2)
lore
Share & tools
lore

Minchan Kim

author maintainer
#0 lore raw

PATCH v2 1/1 zsmalloc: consider ZS_ALMOST_FULL as migrate source

From: Minchan Kim <[email protected]>

There is no reason to prevent select ZS_ALMOST_FULL as migration source if we cannot find source from ZS_ALMOST_EMPTY.

With this patch, zs_can_compact will return more exact result.

* From v1
* remove unnecessary found variable - Sergey

---
 mm/zsmalloc.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
mm/zsmalloc.c +10 -7
index 8c78bcb..9012645 100644
@@ -1686,11 +1686,17 @@ static enum fullness_group putback_zspage(struct zs_pool *pool,
 
 static struct page *isolate_source_page(struct size_class *class)
 {
-	struct page *page;
+	int i;
+	struct page *page = NULL;
+
+	for (i = ZS_ALMOST_EMPTY; i >= ZS_ALMOST_FULL; i--) {
+		page = class->fullness_list[i];
+		if (!page)
+			continue;
 
-	page = class->fullness_list[ZS_ALMOST_EMPTY];
-	if (page)
-		remove_zspage(page, class, ZS_ALMOST_EMPTY);
+		remove_zspage(page, class, i);
+		break;
+	}
 
 	return page;
 }
@@ -1706,9 +1712,6 @@ static unsigned long zs_can_compact(struct size_class *class)
 {
 	unsigned long obj_wasted;
 
-	if (!zs_stat_get(class, CLASS_ALMOST_EMPTY))
-		return 0;
-
 	obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
 		zs_stat_get(class, OBJ_USED);
 
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · Minchan Kim

There is no reason to prevent select ZS_ALMOST_FULL as migration source if we cannot find source from ZS_ALMOST_EMPTY.

With this patch, zs_can_compact will return more exact result.

* From v1
* remove unnecessary found variable - Sergey

	-ss

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author maintainer
#2 lore raw
Quoted 6 lines · Sergey Senozhatsky
Quoted 5 lines · Minchan Kim

There is no reason to prevent select ZS_ALMOST_FULL as migration source if we cannot find source from ZS_ALMOST_EMPTY.

With this patch, zs_can_compact will return more exact result.

Quoted 8 lines
Quoted 5 lines

* From v1
* remove unnecessary found variable - Sergey

Thanks, Sergey!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>