aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2015-09-08 18:03:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commit26f5d7609f03ad8d6dc552458e4e371a62416b37 (patch)
tree33868d7b635a40367d0848dc4b049a8485d1572d
parent21cd3a604797c2774676926a95a3d17d4cd5cbb3 (diff)
list_lru: don't call list_lru_from_kmem if the list_head is empty
If the list_head is empty then we'll have called list_lru_from_kmem for nothing. Move that call inside of the list_empty if block. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Reviewed-by: Vladimir Davydov <vdavydov@parallels.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/list_lru.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 909eca2c820e..e1da19fac1b3 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -99,8 +99,8 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item)
99 struct list_lru_one *l; 99 struct list_lru_one *l;
100 100
101 spin_lock(&nlru->lock); 101 spin_lock(&nlru->lock);
102 l = list_lru_from_kmem(nlru, item);
103 if (list_empty(item)) { 102 if (list_empty(item)) {
103 l = list_lru_from_kmem(nlru, item);
104 list_add_tail(item, &l->list); 104 list_add_tail(item, &l->list);
105 l->nr_items++; 105 l->nr_items++;
106 spin_unlock(&nlru->lock); 106 spin_unlock(&nlru->lock);
@@ -118,8 +118,8 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item)
118 struct list_lru_one *l; 118 struct list_lru_one *l;
119 119
120 spin_lock(&nlru->lock); 120 spin_lock(&nlru->lock);
121 l = list_lru_from_kmem(nlru, item);
122 if (!list_empty(item)) { 121 if (!list_empty(item)) {
122 l = list_lru_from_kmem(nlru, item);
123 list_del_init(item); 123 list_del_init(item);
124 l->nr_items--; 124 l->nr_items--;
125 spin_unlock(&nlru->lock); 125 spin_unlock(&nlru->lock);