Skip to contentSkip to conversation

mm/slub: remove useless condition in deactivate_slab

PATCH In review Pingfan Liu 2 participants 2 messages Sep 26, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/slub: remove useless condition in deactivate_slab

The var l should be used to reflect the original list, on which the page should be. But c->page is not on any list. Furthermore, the current code does not update the value of l. Hence remove the related logic

Cc Christoph Lameter <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc David Rientjes <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Andrew Morton <[email protected]>
---
 mm/slub.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)
mm/slub.c +7 -23
index 8da34a8..a68c2ae 100644
@@ -1992,7 +1992,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
 	enum slab_modes { M_NONE, M_PARTIAL, M_FULL, M_FREE };
 	struct kmem_cache_node *n = get_node(s, page_to_nid(page));
 	int lock = 0;
-	enum slab_modes l = M_NONE, m = M_NONE;
+	enum slab_modes m = M_NONE;
 	void *nextfree;
 	int tail = DEACTIVATE_TO_HEAD;
 	struct page new;
@@ -2088,30 +2088,14 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page,
 		}
 	}
 
-	if (l != m) {
-
-		if (l == M_PARTIAL)
-
-			remove_partial(n, page);
-
-		else if (l == M_FULL)
-
-			remove_full(s, n, page);
-
-		if (m == M_PARTIAL) {
-
-			add_partial(n, page, tail);
-			stat(s, tail);
-
-		} else if (m == M_FULL) {
-
-			stat(s, DEACTIVATE_FULL);
-			add_full(s, n, page);
-
-		}
+	if (m == M_PARTIAL) {
+		add_partial(n, page, tail);
+		stat(s, tail);
+	} else if (m == M_FULL) {
+		stat(s, DEACTIVATE_FULL);
+		add_full(s, n, page);
 	}
 
-	l = m;
 	if (!__cmpxchg_double_slab(s, page,
 				old.freelist, old.counters,
 				new.freelist, new.counters,
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Pingfan Liu

The var l should be used to reflect the original list, on which the page should be. But c->page is not on any list. Furthermore, the current code does not update the value of l. Hence remove the related logic