On Fri, Apr 05, 2013 at 12:01:01PM +0400, Glauber Costa wrote: > On 04/05/2013 05:20 AM, Dave Chinner wrote: > > On Thu, Apr 04, 2013 at 02:53:49PM -0700, Greg Thelen wrote: > >> On Fri, Mar 29 2013, Glauber Costa wrote: > >>> From: Dave Chinner <dchinner@xxxxxxxxxx> > >>> +long > >>> +list_lru_walk( > >>> + struct list_lru *lru, > >>> + list_lru_walk_cb isolate, > >>> + void *cb_arg, > >>> + long nr_to_walk) > >>> +{ > >>> + struct list_head *item, *n; > >>> + long removed = 0; > >>> +restart: > >>> + spin_lock(&lru->lock); > >>> + list_for_each_safe(item, n, &lru->list) { > >>> + int ret; > >>> + > >>> + if (nr_to_walk-- < 0) > >>> + break; > >>> + > >>> + ret = isolate(item, &lru->lock, cb_arg); > >>> + switch (ret) { > >>> + case 0: /* item removed from list */ > >>> + lru->nr_items--; > >>> + removed++; > >>> + break; > >>> + case 1: /* item referenced, give another pass */ > >>> + list_move_tail(item, &lru->list); > >>> + break; > >>> + case 2: /* item cannot be locked, skip */ > >>> + break; > >>> + case 3: /* item not freeable, lock dropped */ > >>> + goto restart; > >> > >> These four magic return values might benefit from an enum (or #define) > >> for clarity. > > > > Obviously, and it was stated that this needed to be done by miself > > when I last posted the patch set many months ago. I've been rather > > busy since then, and so haven't had time to do anything with it. > > > >> Maybe the names would be LRU_OK, LRU_REMOVED, LRU_ROTATE, LRU_RETRY. > > > > Something like that... > > > I can handle that and fold it with credits as usual if you don't mind. Sure, I'm happy for you to do that, along with any other cleanups and fixes that are needed... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- 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>