linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Satyam Sharma" <satyam.sharma@gmail.com>
To: Bert Wesarg <wesarg@informatik.uni-halle.de>
Cc: clameter@sgi.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, dgc@sgi.com,
	Eric Dumazet <dada1@cosmosbay.com>, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [RFC 1/3] SLUB: slab_ops instead of constructors / destructors
Date: Mon, 7 May 2007 01:16:42 +0530	[thread overview]
Message-ID: <a781481a0705061246y10568c25h8d82233dbc43ce5c@mail.gmail.com> (raw)
In-Reply-To: <463E2A37.2030400@informatik.uni-halle.de>

On 5/7/07, Bert Wesarg <wesarg@informatik.uni-halle.de> wrote:
> clameter@sgi.com wrote:
> > +     if (ctor || dtor) {
> > +             so = kzalloc(sizeof(struct slab_ops), GFP_KERNEL);
> > +             so->ctor = ctor;
> > +             so->dtor = dtor;
> > +     }
> > +     return  __kmem_cache_create(s, size, align, flags, so);
> Is this a memory leak?

Yes, but see:

On 5/5/07, clameter@sgi.com <clameter@sgi.com> wrote:
> If constructor or destructor are specified then we will allocate a slab_ops
> structure and populate it with the values specified. Note that this will
> cause a memory leak if the slab is disposed of later. If you need disposable
> slabs then the new API must be used.

BTW:

> > +     if (ctor || dtor) {
> > +             so = kzalloc(sizeof(struct slab_ops), GFP_KERNEL);
> > +             so->ctor = ctor;

It's also a potential oops, actually. kzalloc's return must be checked.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-05-06 19:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04 22:15 [RFC 0/3] Slab Defrag / Slab Targeted Reclaim and general Slab API changes clameter
2007-05-04 22:15 ` [RFC 1/3] SLUB: slab_ops instead of constructors / destructors clameter
2007-05-05 10:14   ` Pekka Enberg
2007-05-05 15:43     ` Christoph Lameter
2007-05-06 19:19   ` Bert Wesarg
2007-05-06 19:46     ` Satyam Sharma [this message]
2007-05-04 22:15 ` [RFC 2/3] SLUB: Implement targeted reclaim and partial list defragmentation clameter
2007-05-04 23:03   ` Christoph Lameter
2007-05-05  1:04     ` Randy Dunlap
2007-05-05  1:07       ` Christoph Lameter
2007-05-05  5:32   ` William Lee Irwin III
2007-05-05 15:35     ` Christoph Lameter
2007-05-05 10:38   ` Andi Kleen
2007-05-05 15:42     ` Christoph Lameter
2007-05-05 17:11       ` Andi Kleen
2007-05-09 15:05   ` Mel Gorman
2007-05-09 16:34     ` Christoph Lameter
2007-05-04 22:15 ` [RFC 3/3] Support targeted reclaim and slab defrag for dentry cache clameter
2007-05-05  5:07 ` [RFC 0/3] Slab Defrag / Slab Targeted Reclaim and general Slab API changes Eric Dumazet
2007-05-05  5:14   ` Christoph Lameter
2007-05-05  5:41     ` Eric Dumazet
2007-05-05  7:37       ` Eric Dumazet
2007-05-05 15:39       ` Christoph Lameter

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=a781481a0705061246y10568c25h8d82233dbc43ce5c@mail.gmail.com \
    --to=satyam.sharma@gmail.com \
    --cc=clameter@sgi.com \
    --cc=dada1@cosmosbay.com \
    --cc=dgc@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=wesarg@informatik.uni-halle.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox