lkml.org 
[lkml]   [2015]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] zsmalloc: consider ZS_ALMOST_FULL as migrate source
On (07/10/15 10:32), Minchan Kim wrote:
> static struct page *isolate_source_page(struct size_class *class)
> {
> struct page *page;
> + int i;
> + bool found = false;
>

why use 'bool found'? just return `page', which will be either NULL
or !NULL?

-ss

> - page = class->fullness_list[ZS_ALMOST_EMPTY];
> - if (page)
> - remove_zspage(page, class, ZS_ALMOST_EMPTY);
> + for (i = ZS_ALMOST_EMPTY; i >= ZS_ALMOST_FULL; i--) {
> + page = class->fullness_list[i];
> + if (!page)
> + continue;
>
> - return page;
> + remove_zspage(page, class, i);
> + found = true;
> + break;
> + }
> +
> + return found ? page : NULL;
> }

-ss


\
 
 \ /
  Last update: 2015-07-10 04:21    [W:0.116 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site