Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716456

Re: [rfc patch] sched/topology: fix domain reconstruction memory leakage

From Mike Galbraith <efault@gmx.de>
Newsgroups linux.kernel
Subject Re: [rfc patch] sched/topology: fix domain reconstruction memory leakage
Date 2017-08-21 15:40 +0200
Message-ID <ugV5T-4XE-1@gated-at.bofh.it> (permalink)
References <ug5gZ-67a-1@gated-at.bofh.it> <ugQ6e-1OX-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2017-08-21 at 10:16 +0200, Peter Zijlstra wrote:
> On Sat, Aug 19, 2017 at 08:10:49AM +0200, Mike Galbraith wrote:
> > Greetings,
> > 
> > While beating on cpu hotplug with the shiny new topology fixes
> > backported, my memory poor 8 socket box fairly quickly leaked itself to
> > death, 0c0e776a9b0f being the culprit.  With the below applied, box
> > took a severe beating overnight without a whimper.
> > 
> > I'm wondering (ergo rfc) if free_sched_groups() shouldn't be renamed to
> > put_sched_groups() instead, with overlapping domains taking a group
> > reference reference as well so they can put both sg/sgc rather than put
> > one free the other.  Those places that want an explicit free can pass
> > free to only explicitly free sg (or use two functions).  Minimalist
> > approach works (minus signs, yay), but could perhaps use some "pretty".
> > 
> > sched/topology: fix domain reconstruction memory leakage
> 
> I was sitting on this one:
> 
>   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=sched/core&id=c63d18dd6ea59eec5cba857835f788943ff9f0d5

The comment in the patch reads better to me like so:

@@ -345,15 +346,12 @@ static void free_sched_groups(struct sch
 static void destroy_sched_domain(struct sched_domain *sd)
 {
 	/*
-	 * If its an overlapping domain it has private groups, iterate and
-	 * nuke them all.
+	 * A normal sched domain may have multiple group references, an
+	 * overlapping domain, having private groups, only one.  Iterate,
+	 * dropping group/capacity references, freeing where none remain.
 	 */
-	if (sd->flags & SD_OVERLAP) {
-		free_sched_groups(sd->groups, 1);
-	} else if (atomic_dec_and_test(&sd->groups->ref)) {
-		kfree(sd->groups->sgc);
-		kfree(sd->groups);
-	}
+	free_sched_groups(sd->groups, 1);
+
 	if (sd->shared && atomic_dec_and_test(&sd->shared->ref))
 		kfree(sd->shared);
 	kfree(sd);

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[rfc patch] sched/topology: fix domain reconstruction memory leakage Mike Galbraith <efault@gmx.de> - 2017-08-19 08:20 +0200
  Re: [rfc patch] sched/topology: fix domain reconstruction memory  leakage Mike Galbraith <efault@gmx.de> - 2017-08-19 08:30 +0200
  Re: [rfc patch] sched/topology: fix domain reconstruction memory  leakage Peter Zijlstra <peterz@infradead.org> - 2017-08-21 10:20 +0200
    Re: [rfc patch] sched/topology: fix domain reconstruction memory  leakage Mike Galbraith <efault@gmx.de> - 2017-08-21 13:50 +0200
    Re: [rfc patch] sched/topology: fix domain reconstruction memory  leakage Mike Galbraith <efault@gmx.de> - 2017-08-21 15:40 +0200
      Re: [rfc patch] sched/topology: fix domain reconstruction memory  leakage Peter Zijlstra <peterz@infradead.org> - 2017-08-21 15:50 +0200

csiph-web