diff --git a/mm/slab.c b/mm/slab.c
index da4068a9530704516f2f2b1d9af285f9caa2250a..2915d912e89a4c5bb0f5edabc2ee8e768960263d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4291,8 +4291,12 @@ static int leaks_show(struct seq_file *m, void *p)
 	 * whole processing.
 	 */
 	do {
-		set_store_user_clean(cachep);
 		drain_cpu_caches(cachep);
+		/*
+		 * drain_cpu_caches() could make kmemleak_object and
+		 * debug_objects_cache dirty, so reset afterwards.
+		 */
+		set_store_user_clean(cachep);
 
 		x[1] = 0;