On Fri, Mar 29 2013, Glauber Costa wrote: > From: Dave Chinner <dchinner@xxxxxxxxxx> > > The current shrinker callout API uses an a single shrinker call for > multiple functions. To determine the function, a special magical > value is passed in a parameter to change the behaviour. This > complicates the implementation and return value specification for > the different behaviours. > > Separate the two different behaviours into separate operations, one > to return a count of freeable objects in the cache, and another to > scan a certain number of objects in the cache for freeing. In > defining these new operations, ensure the return values and > resultant behaviours are clearly defined and documented. > > Modify shrink_slab() to use the new API and implement the callouts > for all the existing shrinkers. > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > --- > include/linux/shrinker.h | 37 +++++++++++++++++++++++++---------- > mm/vmscan.c | 51 +++++++++++++++++++++++++++++++----------------- > 2 files changed, 60 insertions(+), 28 deletions(-) > > diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h > index ac6b8ee..4f59615 100644 > --- a/include/linux/shrinker.h > +++ b/include/linux/shrinker.h > @@ -4,31 +4,47 @@ > /* > * This struct is used to pass information from page reclaim to the shrinkers. > * We consolidate the values for easier extention later. > + * > + * The 'gfpmask' refers to the allocation we are currently trying to > + * fulfil. > + * > + * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is > + * querying the cache size, so a fastpath for that case is appropriate. > */ > struct shrink_control { > gfp_t gfp_mask; > > /* How many slab objects shrinker() should scan and try to reclaim */ > - unsigned long nr_to_scan; > + long nr_to_scan; Why convert from unsigned? What's a poor shrinker to do with a negative to-scan request? [snip] -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html