LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: "Peter Zijlstra" <a.p.zijlstra@chello.nl>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	linux-mm@kvack.org, "Ingo Molnar" <mingo@elte.hu>
Subject: Re: [PATCH] leak less memory in failure paths of alloc_rt_sched_group()
Date: Mon, 3 Mar 2008 00:29:19 +0100	[thread overview]
Message-ID: <9a8748490803021529m695f91egcc9e4dba13a5c911@mail.gmail.com> (raw)
In-Reply-To: <1204499992.6240.109.camel@lappy>

On 03/03/2008, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>
>  On Mon, 2008-03-03 at 00:09 +0100, Jesper Juhl wrote:
>  > In kernel/sched.c b/kernel/sched.c::alloc_rt_sched_group() we currently do
>  > some paired memory allocations, and if one fails we bail out without
>  > freeing the previous one.
>  >
>  > If we fail inside the loop we should proably roll the whole thing back.
>  > This patch does not do that, it simply frees the first member of the
>  > paired alloc if the second fails. This is not perfect, but it's a simple
>  > change that will, at least, result in us leaking a little less than we
>  > currently do when an allocation fails.
>  >
>  > So, not perfect, but better than what we currently have.
>  > Please consider applying.
>
>
> Doesn't the following handle that:
>
>  sched_create_group()
>  {
>  ...
>         if (!alloc_rt_sched_group())
>                 goto err;
>  ...
>
>  err:
>         free_sched_group();
>  }
>
>
>  free_sched_group()
>  {
>  ...
>         free_rt_sched_group();
>  ...
>  }
>
>  free_rt_sched_group()
>  {
>         free all relevant stuff
>  }
>

Hmmm, it might. I must admit I only looked at alloc_rt_sched_group()
isolated, and what I saw looked like leaks. It seems I need to do a
more thorough reading of the code to be dead sure.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

      reply	other threads:[~2008-03-02 23:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 23:09 Jesper Juhl
2008-03-02 23:19 ` Peter Zijlstra
2008-03-02 23:29   ` Jesper Juhl [this message]

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=9a8748490803021529m695f91egcc9e4dba13a5c911@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [PATCH] leak less memory in failure paths of alloc_rt_sched_group()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).