Skip to content

Commit 0dc63d4

Browse files
sergey-senozhatskytorvalds
authored andcommitted
zsmalloc: cosmetic compaction code adjustments
Change zs_object_copy() argument order to be (DST, SRC) rather than (SRC, DST). copy/move functions usually have (to, from) arguments order. Rename alloc_target_page() to isolate_target_page(). This function doesn't allocate anything, it isolates target page, pretty much like isolate_source_page(). Tweak __zs_compact() comment. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 04f0590 commit 0dc63d4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎mm/zsmalloc.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle)
14711471
}
14721472
EXPORT_SYMBOL_GPL(zs_free);
14731473

1474-
static void zs_object_copy(unsigned long src, unsigned long dst,
1474+
static void zs_object_copy(unsigned long dst, unsigned long src,
14751475
struct size_class *class)
14761476
{
14771477
struct page *s_page, *d_page;
@@ -1612,7 +1612,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
16121612

16131613
used_obj = handle_to_obj(handle);
16141614
free_obj = obj_malloc(d_page, class, handle);
1615-
zs_object_copy(used_obj, free_obj, class);
1615+
zs_object_copy(free_obj, used_obj, class);
16161616
index++;
16171617
record_obj(handle, free_obj);
16181618
unpin_tag(handle);
@@ -1628,7 +1628,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
16281628
return ret;
16291629
}
16301630

1631-
static struct page *alloc_target_page(struct size_class *class)
1631+
static struct page *isolate_target_page(struct size_class *class)
16321632
{
16331633
int i;
16341634
struct page *page;
@@ -1718,11 +1718,11 @@ static unsigned long __zs_compact(struct zs_pool *pool,
17181718
cc.index = 0;
17191719
cc.s_page = src_page;
17201720

1721-
while ((dst_page = alloc_target_page(class))) {
1721+
while ((dst_page = isolate_target_page(class))) {
17221722
cc.d_page = dst_page;
17231723
/*
1724-
* If there is no more space in dst_page, try to
1725-
* allocate another zspage.
1724+
* If there is no more space in dst_page, resched
1725+
* and see if anyone had allocated another zspage.
17261726
*/
17271727
if (!migrate_zspage(pool, class, &cc))
17281728
break;

0 commit comments

Comments
 (0)