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

rpms/kernel/FC-6 linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch, NONE, 1.1 kernel-2.6.spec, 1.3038, 1.3039



Author: cebbert

Update of /cvs/dist/rpms/kernel/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv16866

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch 
Log Message:
* Thu Nov 15 2007 Chuck Ebbert <cebbert redhat com>
- Fix memory leak in SLUB allocator.


linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch:
 slub.c |   22 +---------------------
 1 files changed, 1 insertion(+), 21 deletions(-)

--- NEW FILE linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch ---
>From stable-bounces linux kernel org Mon Nov  5 11:24:17 2007
From: Christoph Lameter <clameter sgi com>
Date: Mon, 5 Nov 2007 11:23:51 -0800 (PST)
Subject: SLUB: Fix memory leak by not reusing cpu_slab
To: stable kernel org
Cc: linux-kernel vger kernel org, Olivér Pintér <oliver pntr gmail com>, Hugh Dickins <hugh veritas com>, Andrew Morton <akpm linux-foundation org>, Linus Torvalds <torvalds linux-foundation org>, Willy Tarreau <w 1wt eu>
Message-ID: <Pine LNX 4 64 0711051123130 15999 schroedinger engr sgi com>

From: Christoph Lameter <clameter sgi com>

backport of 05aa345034de6ae9c77fb93f6a796013641d57d5 from Linus's tree.

SLUB: Fix memory leak by not reusing cpu_slab

Fix the memory leak that may occur when we attempt to reuse a cpu_slab
that was allocated while we reenabled interrupts in order to be able to
grow a slab cache. The per cpu freelist may contain objects and in that
situation we may overwrite the per cpu freelist pointer loosing objects.
This only occurs if we find that the concurrently allocated slab fits
our allocation needs.

If we simply always deactivate the slab then the freelist will be properly
reintegrated and the memory leak will go away.

Signed-off-by: Christoph Lameter <clameter sgi com>
Cc: Hugh Dickins <hugh veritas com>
Signed-off-by: Greg Kroah-Hartman <gregkh suse de>

---
 mm/slub.c |   22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1431,28 +1431,8 @@ new_slab:
 	page = new_slab(s, gfpflags, node);
 	if (page) {
 		cpu = smp_processor_id();
-		if (s->cpu_slab[cpu]) {
-			/*
-			 * Someone else populated the cpu_slab while we
-			 * enabled interrupts, or we have gotten scheduled
-			 * on another cpu. The page may not be on the
-			 * requested node even if __GFP_THISNODE was
-			 * specified. So we need to recheck.
-			 */
-			if (node == -1 ||
-				page_to_nid(s->cpu_slab[cpu]) == node) {
-				/*
-				 * Current cpuslab is acceptable and we
-				 * want the current one since its cache hot
-				 */
-				discard_slab(s, page);
-				page = s->cpu_slab[cpu];
-				slab_lock(page);
-				goto load_freelist;
-			}
-			/* New slab does not fit our expectations */
+		if (s->cpu_slab[cpu])
 			flush_slab(s, s->cpu_slab[cpu], cpu);
-		}
 		slab_lock(page);
 		SetSlabFrozen(page);
 		s->cpu_slab[cpu] = page;


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/FC-6/kernel-2.6.spec,v
retrieving revision 1.3038
retrieving revision 1.3039
diff -u -r1.3038 -r1.3039
--- kernel-2.6.spec	13 Nov 2007 22:59:13 -0000	1.3038
+++ kernel-2.6.spec	15 Nov 2007 23:04:22 -0000	1.3039
@@ -578,6 +578,7 @@
 Patch601: linux-2.6-input-ff-create-limit-memory.patch
 Patch602: linux-2.6-x86_64-e820_hole_size.patch
 Patch603: linux-2.6-x86_64-fix-boot-speed-on-vt.patch
+Patch604: linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch
 
 Patch610: linux-2.6-defaults-fat-utf8.patch
 Patch620: linux-2.6-defaults-unicode-vt.patch
@@ -1253,6 +1254,8 @@
 ApplyPatch linux-2.6-x86_64-e820_hole_size.patch
 # fix boot speed on VT enabled processors
 ApplyPatch linux-2.6-x86_64-fix-boot-speed-on-vt.patch
+# fix SLUB memory leak
+ApplyPatch linux-2.6-slub-fix-memory-leak-by-not-reusing-cpu_slab.patch
 
 # Changes to upstream defaults.
 # Use UTF-8 by default on VFAT.
@@ -2278,6 +2281,9 @@
 %endif
 
 %changelog
+* Thu Nov 15 2007 Chuck Ebbert <cebbert redhat com>
+- Fix memory leak in SLUB allocator.
+
 * Tue Nov 13 2007 David Woodhouse <dwmw2 redhat com>
 - Fix ppc64 vDSO DWARF info for CR register (#350291)
 


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