Message ID | 1386241253-5781-3-git-send-email-jlayton@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Dec 05, 2013 at 06:00:52AM -0500, Jeff Layton wrote: > The current list_lru_walk_node implementation always walks the entire > list. In some cases, we can be sure that when an entry isn't freeable > that none of the rest of the entries on the list will be either. > > Create a new LRU_SKIP_REST return value that not only indicates that > the current entry was skipped, but that caller should stop scanning > the current node. > > Signed-off-by: Jeff Layton <jlayton@redhat.com> I'd call it LRU_DONE, but otherwise this looks fine to me. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 5 Dec 2013 05:30:08 -0800 Christoph Hellwig <hch@infradead.org> wrote: > On Thu, Dec 05, 2013 at 06:00:52AM -0500, Jeff Layton wrote: > > The current list_lru_walk_node implementation always walks the entire > > list. In some cases, we can be sure that when an entry isn't freeable > > that none of the rest of the entries on the list will be either. > > > > Create a new LRU_SKIP_REST return value that not only indicates that > > the current entry was skipped, but that caller should stop scanning > > the current node. > > > > Signed-off-by: Jeff Layton <jlayton@redhat.com> > > I'd call it LRU_DONE, but otherwise this looks fine to me. > Ok, if we end up taking this in I'll change the name... Thanks,
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index 3ce5417..6140c3a 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -15,6 +15,8 @@ enum lru_status { LRU_REMOVED, /* item removed from list */ LRU_ROTATE, /* item referenced, give another pass */ LRU_SKIP, /* item cannot be locked, skip */ + LRU_SKIP_REST, /* item isn't freeable, and none of the rest + on the list will be either */ LRU_RETRY, /* item not freeable. May drop the lock internally, but has to return locked. */ }; diff --git a/mm/list_lru.c b/mm/list_lru.c index 72f9dec..abec7fb 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -98,6 +98,8 @@ restart: break; case LRU_SKIP: break; + case LRU_SKIP_REST: + goto done; case LRU_RETRY: /* * The lru lock has been dropped, our list traversal is @@ -108,7 +110,7 @@ restart: BUG(); } } - +done: spin_unlock(&nlru->lock); return isolated; }
The current list_lru_walk_node implementation always walks the entire list. In some cases, we can be sure that when an entry isn't freeable that none of the rest of the entries on the list will be either. Create a new LRU_SKIP_REST return value that not only indicates that the current entry was skipped, but that caller should stop scanning the current node. Signed-off-by: Jeff Layton <jlayton@redhat.com> --- include/linux/list_lru.h | 2 ++ mm/list_lru.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)