[PATCH] mm/slub: remove useless condition in deactivate_slab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Cc: Christoph Lameter <cl@xxxxxxxxx>
Cc: Pekka Enberg <penberg@xxxxxxxxxx>
Cc: David Rientjes <rientjes@xxxxxxxxxx>
Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
 mm/slub.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 8da34a8..a68c2ae 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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,
-- 
2.7.4




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux