Commit:     05aa345034de6ae9c77fb93f6a796013641d57d5
Parent:     aac9e28d2f3d3c1eacc4114d685864a2a6423b80
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 5 11:31:58 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Nov 5 11:37:12 2007 -0800

    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 <[EMAIL PROTECTED]>
    Acked-by: Hugh Dickins <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 mm/slub.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index bcdb2c8..84f59fd 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1511,26 +1511,8 @@ new_slab:
        if (new) {
                c = get_cpu_slab(s, smp_processor_id());
-               if (c->page) {
-                       /*
-                        * 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_match(c, node)) {
-                               /*
-                                * Current cpuslab is acceptable and we
-                                * want the current one since its cache hot
-                                */
-                               discard_slab(s, new);
-                               slab_lock(c->page);
-                               goto load_freelist;
-                       }
-                       /* New slab does not fit our expectations */
+               if (c->page)
                        flush_slab(s, c);
-               }
                c->page = new;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to