Re: [PATCH] zsmalloc: fix obj_to_head use page_private(page) as value but not pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 6, 2015 at 9:54 PM, Minchan Kim <minchan@xxxxxxxxxx> wrote:
> 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@xxxxxxxxxx>
>
> With fixing the comment,
>
> Acked-by: Minchan Kim <minchan@xxxxxxxxxx>
>
> Thanks for the fix, Hui.
>

Thanks!  I will post a new version.

Best,
Hui

> --
> Kind regards,
> Minchan Kim

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]