zsmalloc: use class->pages_per_zspage
Subsystems (2)
Minchan Kim
maintainerPATCH v2 1/1 zsmalloc: use class->pages_per_zspage
There is no need to recalcurate pages_per_zspage in runtime. Just use class->pages_per_zspage to avoid unnecessary runtime overhead.
* From v1
* fix up __zs_compact - Sergey
Signed-off-by Minchan Kim <[email protected]>
--- mm/zsmalloc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
mm/zsmalloc.c +2 -3
@@ -1711,7 +1711,7 @@ static unsigned long zs_can_compact(struct size_class *class) obj_wasted /=get_maxobj_per_zspage (class->size, class->pages_per_zspage); -return obj_wasted *get_pages_per_zspage (class->size); +return obj_wasted * class->pages_per_zspage; }static void __zs_compact (struct zs_pool *pool,struct size_class *class)
@@ -1749,8 +1749,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)putback_zspage (pool, class, dst_page);if (putback_zspage (pool, class, src_page) ==ZS_EMPTY ) - pool->stats.pages_compacted += -get_pages_per_zspage (class->size); + pool->stats.pages_compacted += class->pages_per_zspage;spin_unlock (&class->lock);cond_resched ();spin_lock (&class->lock);
Signature · 7 lines
1.9.1 -- 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>
Quoted 8 lines · Minchan Kim
There is no need to recalcurate
pages_per_zspagein runtime. Just useclass->pages_per_zspageto avoid unnecessary runtime overhead.* From v1
* fix up__zs_compact- SergeySigned-off-by Minchan Kim <[email protected]>
thanks.
-ss
Quoted 18 lines
--- mm/zsmalloc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)mm/zsmalloc.c +1
-1@@ -1711,7 +1711,7 @@ static unsigned long zs_can_compact(struct size_class *class) obj_wasted /=get_maxobj_per_zspage (class->size, class->pages_per_zspage); -return obj_wasted *get_pages_per_zspage (class->size); +return obj_wasted * class->pages_per_zspage; }static void __zs_compact (struct zs_pool *pool,struct size_class *class)
mm/zsmalloc.c static void __zs_compact(struct zs_pool *pool, struct size_class *class) · line 1755
Quoted 9 lines
mm/zsmalloc.c +1
-2@@ -1749,8 +1749,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)putback_zspage (pool, class, dst_page);if (putback_zspage (pool, class, src_page) ==ZS_EMPTY ) - pool->stats.pages_compacted += -get_pages_per_zspage (class->size); + pool->stats.pages_compacted += class->pages_per_zspage;spin_unlock (&class->lock);cond_resched ();spin_lock (&class->lock);
--
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>