From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752670AbbJFNyo (ORCPT ); Tue, 6 Oct 2015 09:54:44 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34294 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751472AbbJFNyn (ORCPT ); Tue, 6 Oct 2015 09:54:43 -0400 Date: Tue, 6 Oct 2015 22:54:31 +0900 From: Minchan Kim To: Hui Zhu Cc: ngupta@vflare.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, teawater@gmail.com, Andrew Morton , Sergey Senozhatsky Subject: Re: [PATCH] zsmalloc: fix obj_to_head use page_private(page) as value but not pointer Message-ID: <20151006135303.GA31853@blaptop> References: <1444033381-5726-1-git-send-email-zhuhui@xiaomi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444033381-5726-1-git-send-email-zhuhui@xiaomi.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 With fixing the comment, Acked-by: Minchan Kim Thanks for the fix, Hui. -- Kind regards, Minchan Kim