Hi Balbir, On Tue, Nov 30, 2010 at 7:15 PM, Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote: > Refactor zone_reclaim, move reusable functionality outside > of zone_reclaim. Make zone_reclaim_unmapped_pages modular > > Signed-off-by: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> > --- > mm/vmscan.c | 35 +++++++++++++++++++++++------------ > 1 files changed, 23 insertions(+), 12 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index 325443a..0ac444f 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2719,6 +2719,27 @@ static long zone_pagecache_reclaimable(struct zone *zone) > } > > /* > + * Helper function to reclaim unmapped pages, we might add something > + * similar to this for slab cache as well. Currently this function > + * is shared with __zone_reclaim() > + */ > +static inline void > +zone_reclaim_unmapped_pages(struct zone *zone, struct scan_control *sc, > + unsigned long nr_pages) > +{ > + int priority; > + /* > + * Free memory by calling shrink zone with increasing > + * priorities until we have enough memory freed. > + */ > + priority = ZONE_RECLAIM_PRIORITY; > + do { > + shrink_zone(priority, zone, sc); > + priority--; > + } while (priority >= 0 && sc->nr_reclaimed < nr_pages); > +} > + I don't see any specific logic about naming "zone_reclaim_unmapped_pages" in your function. Maybe, caller of this function have to handle sc->may_unmap. So, this function's naming is not good. As I see your logic, the function name would be just "zone_reclaim_pages" If you want to name it with zone_reclaim_unmapped_pages, it could be better with setting sc->may_unmap in this function. -- Kind regards, Minchan Kim -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html