From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages
Date: Thu, 2 Jul 2015 11:13:54 +0900 [thread overview]
Message-ID: <20150702021354.GA637@swordfish> (raw)
In-Reply-To: <20150701072952.GA537@swordfish>
On (07/01/15 16:29), Sergey Senozhatsky wrote:
> if (putback_zspage(.. src_page))
> pool->num_migrated++;
pool->num_migrated += class->pages_per_zspage;
Of course.
> (c) or we can check src_page fullness (or simply if src_page->inuse == 0)
> in __zs_compact() and increment ->num_migrated for ZS_EMPTY page. But this
> is what free_zspage() already does.
In other words, something like this (and we don't need nr_migrated in
zs_compact_control anymore). Not a real patch, just to demonstrate the
idea.
---
@@ -1596,8 +1596,6 @@ struct zs_compact_control {
/* Starting object index within @s_page which used for live object
* in the subpage. */
int index;
- /* How many of objects were migrated */
- int nr_migrated;
};
static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
@@ -1634,7 +1632,6 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
record_obj(handle, free_obj);
unpin_tag(handle);
obj_free(pool, class, used_obj);
- cc->nr_migrated++;
}
/* Remember last position in this iteration */
@@ -1720,7 +1717,6 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
struct page *src_page;
struct page *dst_page = NULL;
- cc.nr_migrated = 0;
spin_lock(&class->lock);
while ((src_page = isolate_source_page(class))) {
@@ -1748,6 +1744,9 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
if (dst_page == NULL)
break;
+ if (!src_page->inuse)
+ pool->num_migrated += class->pages_per_zspage;
+
putback_zspage(pool, class, dst_page);
putback_zspage(pool, class, src_page);
spin_unlock(&class->lock);
@@ -1758,8 +1757,6 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
if (src_page)
putback_zspage(pool, class, src_page);
- pool->num_migrated += cc.nr_migrated;
-
spin_unlock(&class->lock);
}
--
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>
next prev parent reply other threads:[~2015-07-02 2:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 12:35 [RFC][PATCHv4 0/7] mm/zsmalloc: introduce automatic pool compaction Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 1/7] zsmalloc: drop unused variable `nr_to_migrate' Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 2/7] zsmalloc: always keep per-class stats Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 3/7] zsmalloc: introduce zs_can_compact() function Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 4/7] zsmalloc: cosmetic compaction code adjustments Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 5/7] zsmalloc/zram: store compaction stats in zspool Sergey Senozhatsky
2015-06-30 12:35 ` [RFC][PATCHv4 6/7] zsmalloc: account the number of compacted pages Sergey Senozhatsky
2015-07-01 7:29 ` Sergey Senozhatsky
2015-07-02 2:13 ` Sergey Senozhatsky [this message]
2015-07-06 7:52 ` Minchan Kim
2015-06-30 12:35 ` [RFC][PATCHv4 7/7] zsmalloc: register a shrinker to trigger auto-compaction Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150702021354.GA637@swordfish \
--to=sergey.senozhatsky.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox