patch-2.3.99-pre4 linux/mm/slab.c

Next file: linux/mm/swap_state.c
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre3/linux/mm/slab.c linux/mm/slab.c
@@ -127,7 +127,7 @@
  * SLAB_SELFTEST	- 1 to perform a few tests, mainly for development.
  */
 #define		SLAB_MGMT_CHECKS	1
-#define		SLAB_DEBUG_SUPPORT	0
+#define		SLAB_DEBUG_SUPPORT	1
 #define		SLAB_STATS		0
 #define		SLAB_SELFTEST		0
 
@@ -1019,6 +1019,16 @@
 		slabp = cachep->c_lastp;
 		if (slabp->s_inuse || slabp == kmem_slab_end(cachep))
 			break;
+		/*
+		 * If this slab is the first slab with free objects
+		 * (c_freep), and as we are walking the slab chain
+		 * backwards, it is also the last slab with free
+		 * objects.  After unlinking it, there will be no
+		 * slabs with free objects, so point c_freep into the
+		 * cache structure.
+		 */
+		if (cachep->c_freep == slabp)
+			cachep->c_freep = kmem_slab_end(cachep);
 		kmem_slab_unlink(slabp);
 		spin_unlock_irq(&cachep->c_spinlock);
 		kmem_slab_destroy(cachep, slabp);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)