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@xxxxxxxxxx> --- include/linux/list_lru.h | 2 ++ mm/list_lru.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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; } -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html