linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	linaro-kernel@lists.linaro.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 3/8] cpufreq: powerenv: Fix memory leak
Date: Thu, 2 Jun 2016 17:13:11 +0530	[thread overview]
Message-ID: <20160602114311.GR3725@vireshk-i7> (raw)
In-Reply-To: <1464867465.11826.4.camel@ellerman.id.au>

On 02-06-16, 21:37, Michael Ellerman wrote:
> On Thu, 2016-06-02 at 16:52 +0530, Viresh Kumar wrote:
> > On 02-06-16, 21:08, Michael Ellerman wrote:
> > > On Wed, 2016-06-01 at 16:04 +0530, Viresh Kumar wrote:
> > > 
> > > > The policy is copied (unnecessarily) and is never freed. Fix it by just
> > > > getting a reference to the existing policy structure and putting it
> > > > back.
> > > > 
> > > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > > 
> > > When was it broken, always?
> > > 
> > > Cc: stable ?
> > 
> > Its a small memory leak and its not that we will fail on something. So
> > didn't bother to add those details, but in case they are required:
> > 
> > Cc: <stable@vger.kernel.org> # 4.3+
> > Fixes: 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling")
> 
> OK. I can't actually see where the copy is?
> 
> But if we are leaking even a small amount of memory in a loop like that, in a
> function that's run semi-regularly, then it's going to add up eventually.

Urg, it wasn't a memory leak actually. I misread.

I somehow thought that cpufreq_get_policy() is also allocating memory
for the policy, but it just memcpy's it into the callers buffer. So,
that's not a problem really.

This patch should be just dropped. Sorry for the noise.

-- 
viresh

  reply	other threads:[~2016-06-02 11:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1464776797.git.viresh.kumar@linaro.org>
2016-06-01 10:34 ` [PATCH 1/8] ARM: s3c24xx: Sort cpufreq tables Viresh Kumar
2016-06-02  6:34   ` Krzysztof Kozlowski
2016-06-01 10:34 ` [PATCH 2/8] cpufreq: s3c24xx: Remove useless checks Viresh Kumar
2016-06-02  6:49   ` Krzysztof Kozlowski
2016-06-02  6:52     ` Viresh Kumar
2016-06-01 10:34 ` [PATCH 3/8] cpufreq: powerenv: Fix memory leak Viresh Kumar
2016-06-02 11:08   ` Michael Ellerman
2016-06-02 11:22     ` Viresh Kumar
2016-06-02 11:37       ` Michael Ellerman
2016-06-02 11:43         ` Viresh Kumar [this message]
2016-06-02 12:08           ` Michael Ellerman
2016-06-01 10:34 ` [PATCH V3 4/8] cpufreq: Remove cpufreq_frequency_get_table() Viresh Kumar
2016-06-01 10:34 ` [PATCH 5/8] cpufreq: ondemand: Don't keep a copy of freq_table pointer Viresh Kumar
2016-06-01 10:34 ` [PATCH 6/8] cpufreq: Drop freq-table param to cpufreq_frequency_table_target() Viresh Kumar
2016-06-01 10:34 ` [PATCH 7/8] cpufreq: Drop 'freq_table' argument of __target_index() Viresh Kumar
2016-06-01 10:34 ` [PATCH 8/8] cpufreq: Return index from cpufreq_frequency_table_target() Viresh Kumar

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=20160602114311.GR3725@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).