All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Hui Zhu <zhuhui@xiaomi.com>
Cc: ngupta@vflare.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, teawater@gmail.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] zsmalloc: fix obj_to_head use page_private(page) as value but not pointer
Date: Tue, 6 Oct 2015 22:54:31 +0900	[thread overview]
Message-ID: <20151006135303.GA31853@blaptop> (raw)
In-Reply-To: <1444033381-5726-1-git-send-email-zhuhui@xiaomi.com>

Hello,

On Mon, Oct 05, 2015 at 04:23:01PM +0800, Hui Zhu wrote:
> In function obj_malloc:
> 	if (!class->huge)
> 		/* record handle in the header of allocated chunk */
> 		link->handle = handle;
> 	else
> 		/* record handle in first_page->private */
> 		set_page_private(first_page, handle);
> The huge's page save handle to private directly.
> 
> But in obj_to_head:
> 	if (class->huge) {
> 		VM_BUG_ON(!is_first_page(page));
> 		return page_private(page);

Typo.
 		return *(unsigned long*)page_private(page);

Please fix the description.

> 	} else
> 		return *(unsigned long *)obj;
> It is used as a pointer.
> 
> So change obj_to_head use page_private(page) as value but not pointer
> in obj_to_head.

The reason why there is no problem until now is huge-class page is
born with ZS_FULL so it couldn't be migrated.
Therefore, it shouldn't be real bug in practice.
However, we need this patch for future-work "VM-aware zsmalloced
page migration" to reduce external fragmentation.

> 
> Signed-off-by: Hui Zhu <zhuhui@xiaomi.com>

With fixing the comment,

Acked-by: Minchan Kim <minchan@kernel.org>

Thanks for the fix, Hui.

-- 
Kind regards,
Minchan Kim

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Hui Zhu <zhuhui@xiaomi.com>
Cc: ngupta@vflare.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, teawater@gmail.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH] zsmalloc: fix obj_to_head use page_private(page) as value but not pointer
Date: Tue, 6 Oct 2015 22:54:31 +0900	[thread overview]
Message-ID: <20151006135303.GA31853@blaptop> (raw)
In-Reply-To: <1444033381-5726-1-git-send-email-zhuhui@xiaomi.com>

Hello,

On Mon, Oct 05, 2015 at 04:23:01PM +0800, Hui Zhu wrote:
> In function obj_malloc:
> 	if (!class->huge)
> 		/* record handle in the header of allocated chunk */
> 		link->handle = handle;
> 	else
> 		/* record handle in first_page->private */
> 		set_page_private(first_page, handle);
> The huge's page save handle to private directly.
> 
> But in obj_to_head:
> 	if (class->huge) {
> 		VM_BUG_ON(!is_first_page(page));
> 		return page_private(page);

Typo.
 		return *(unsigned long*)page_private(page);

Please fix the description.

> 	} else
> 		return *(unsigned long *)obj;
> It is used as a pointer.
> 
> So change obj_to_head use page_private(page) as value but not pointer
> in obj_to_head.

The reason why there is no problem until now is huge-class page is
born with ZS_FULL so it couldn't be migrated.
Therefore, it shouldn't be real bug in practice.
However, we need this patch for future-work "VM-aware zsmalloced
page migration" to reduce external fragmentation.

> 
> Signed-off-by: Hui Zhu <zhuhui@xiaomi.com>

With fixing the comment,

Acked-by: Minchan Kim <minchan@kernel.org>

Thanks for the fix, Hui.

-- 
Kind regards,
Minchan Kim

  parent reply	other threads:[~2015-10-06 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05  8:23 [PATCH] zsmalloc: fix obj_to_head use page_private(page) as value but not pointer Hui Zhu
2015-10-05  8:23 ` Hui Zhu
2015-10-06 10:59 ` Sergey Senozhatsky
2015-10-06 10:59   ` Sergey Senozhatsky
2015-10-06 13:54 ` Minchan Kim [this message]
2015-10-06 13:54   ` Minchan Kim
2015-10-07  4:44   ` Hui Zhu
2015-10-07  4:44     ` Hui Zhu
2015-10-07  4:45   ` [PATCH v2] " Hui Zhu
2015-10-07  4:45     ` Hui Zhu

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=20151006135303.GA31853@blaptop \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=teawater@gmail.com \
    --cc=zhuhui@xiaomi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.