linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] zsmalloc: consider ZS_ALMOST_FULL as migrate source
@ 2015-07-10  5:31 Minchan Kim
  2015-07-10  5:46 ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Minchan Kim @ 2015-07-10  5:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Sergey Senozhatsky, Nitin Gupta, linux-kernel, linux-mm,
	Minchan Kim

From: Minchan Kim <minchan.kim@lge.com>

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

Signed-off-by: Minchan Kim <minchan.kim@lge.com>
---
 mm/zsmalloc.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 8c78bcb..9012645 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -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);
 
-- 
1.7.9.5

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] zsmalloc: consider ZS_ALMOST_FULL as migrate source
  2015-07-10  5:31 [PATCH v2] zsmalloc: consider ZS_ALMOST_FULL as migrate source Minchan Kim
@ 2015-07-10  5:46 ` Sergey Senozhatsky
  2015-07-10  6:00   ` Minchan Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2015-07-10  5:46 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, Sergey Senozhatsky, Nitin Gupta, linux-kernel,
	linux-mm, Minchan Kim

On (07/10/15 14:31), Minchan Kim wrote:
> 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
> 
> Signed-off-by: Minchan Kim <minchan.kim@lge.com>
> 

Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] zsmalloc: consider ZS_ALMOST_FULL as migrate source
  2015-07-10  5:46 ` Sergey Senozhatsky
@ 2015-07-10  6:00   ` Minchan Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Minchan Kim @ 2015-07-10  6:00 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Andrew Morton, Sergey Senozhatsky, Nitin Gupta, linux-kernel,
	linux-mm, Minchan Kim

On Fri, Jul 10, 2015 at 02:46:54PM +0900, Sergey Senozhatsky wrote:
> On (07/10/15 14:31), Minchan Kim wrote:
> > 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
> > 
> > Signed-off-by: Minchan Kim <minchan.kim@lge.com>
> > 
> 
> Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 

Thanks, Sergey!

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-10  6:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-10  5:31 [PATCH v2] zsmalloc: consider ZS_ALMOST_FULL as migrate source Minchan Kim
2015-07-10  5:46 ` Sergey Senozhatsky
2015-07-10  6:00   ` Minchan Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).