summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/list_lru.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 9a1f7df1afc9..7572f8e70b86 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -176,13 +176,16 @@ unsigned long list_lru_count_one(struct list_lru *lru,
{
struct list_lru_node *nlru = &lru->node[nid];
struct list_lru_one *l;
- unsigned long count;
+ long count;
rcu_read_lock();
l = list_lru_from_memcg_idx(nlru, memcg_cache_id(memcg));
count = READ_ONCE(l->nr_items);
rcu_read_unlock();
+ if (unlikely(count < 0))
+ count = 0;
+
return count;
}
EXPORT_SYMBOL_GPL(list_lru_count_one);