linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slub: remove useless condition in deactivate_slab
@ 2018-09-26  5:57 Pingfan Liu
  2018-09-26 16:10 ` Christopher Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: Pingfan Liu @ 2018-09-26  5:57 UTC (permalink / raw)
  To: linux-mm
  Cc: Pingfan Liu, Christoph Lameter, Pekka Enberg, David Rientjes,
	Joonsoo Kim, Andrew Morton

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@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-26 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  5:57 [PATCH] mm/slub: remove useless condition in deactivate_slab Pingfan Liu
2018-09-26 16:10 ` Christopher Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox