All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: mingo@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: patch -- mempool buglet (?)
Date: Tue, 31 Dec 2002 10:18:47 -0800	[thread overview]
Message-ID: <3E11DF87.4090901@pacbell.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

I noticed this when reading the mempool code ... looked
wrong to me, it was using kfree() not the de-allocator
matching the allocation it just made.  This is on a fault
path that likely doesn't get much use.

Compiles, untested, "looks right".

- Dave

[-- Attachment #2: mempool.patch --]
[-- Type: text/plain, Size: 494 bytes --]

--- mm/mempool.c-dist	Tue Dec 31 10:03:51 2002
+++ mm/mempool.c	Tue Dec 31 10:04:24 2002
@@ -142,14 +142,14 @@
 		element = pool->alloc(gfp_mask, pool->pool_data);
 		if (!element)
 			goto out;
 		spin_lock_irqsave(&pool->lock, flags);
 		if (pool->curr_nr < pool->min_nr)
 			add_element(pool, element);
-		else
-			kfree(element);		/* Raced */
+		else 	/* Raced */
+			pool->free(element, pool->pool_data);
 	}
 out_unlock:
 	spin_unlock_irqrestore(&pool->lock, flags);
 out:
 	return 0;
 }

             reply	other threads:[~2002-12-31 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31 18:18 David Brownell [this message]
2002-12-31 19:27 ` patch -- mempool buglet (?) Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E11DF87.4090901@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.