lkml.org 
[lkml]   [2015]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCHv3 4/7] zsmalloc: introduce zs_can_compact() function
On (06/29/15 15:45), Minchan Kim wrote:
[..]
> > +/*
> > + * Make sure that we actually can compact this class,
> > + * IOW if migration will release at least one szpage.
>
> zspage,

ok.

> > + *
> > + * Should be called under class->lock
>
> Please comment about return.

ok.

> > + */
> > +static unsigned long zs_can_compact(struct size_class *class)
> > +{
> > + /*
> > + * Calculate how many unused allocated objects we
> > + * have and see if we can free any zspages. Otherwise,
> > + * compaction can just move objects back and forth w/o
> > + * any memory gain.
> > + */
> > + unsigned long obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
> > + zs_stat_get(class, OBJ_USED);
> > +
>
> I want to check one more thing.
>
> We could have lots of ZS_ALMOST_FULL but no ZS_ALMOST_EMPTY.
> In this implementation, compaction cannot have a source so
> it would better to bail out.
> IOW,
>
> if (!zs_stat_get(class, CLASS_ALMOST_EMPTY))
> return 0;

ok.

-ss


\
 
 \ /
  Last update: 2015-06-29 11:21    [W:0.100 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site