All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	rjw@rjwysocki.net, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, Eduardo Valentin <edubezval@gmail.com>,
	Javi Merino <javi.merino@kernel.org>,
	Leo Yan <leo.yan@linaro.org>,
	Kevin Wangtao <kevin.wangtao@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Rui Zhang <rui.zhang@intel.com>,
	Daniel Thompson <daniel.thompson@linaro.org>,
	Andrea Parri <andrea.parri@amarulasolutions.com>
Subject: Re: [PATCH V6] powercap/drivers/idle_injection: Add an idle injection framework
Date: Wed, 13 Jun 2018 13:54:31 +0530	[thread overview]
Message-ID: <20180613082431.wsouzw25dx7wugni@vireshk-i7> (raw)
In-Reply-To: <20180612125930.GP12217@hirez.programming.kicks-ass.net>

On 12-06-18, 14:59, Peter Zijlstra wrote:
> On Tue, Jun 12, 2018 at 02:00:11PM +0200, Daniel Lezcano wrote:
> > +struct idle_injection_device {
> 
> remove this:
> > +	cpumask_var_t cpumask;
> 
> > +	struct hrtimer timer;
> > +	struct completion stop_complete;
> > +	unsigned int idle_duration_ms;
> > +	unsigned int run_duration_ms;
> > +	atomic_t count;
> 
> add:
> 	unsigned long cpumask[0];
> > +};
> 
> 
> > +static struct idle_injection_device *ii_dev_alloc(void)
> > +{
> > +	struct idle_injection_device *ii_dev;
> > +
> > +	ii_dev = kzalloc(sizeof(*ii_dev), GFP_KERNEL);
> 
> use:
> 
> 	sizeof(*ii_dev) + cpumask_size()
> 
> > +	if (!ii_dev)
> > +		return NULL;
> > +
> 
> delete:
> 
> > +	if (!alloc_cpumask_var(&ii_dev->cpumask, GFP_KERNEL)) {
> > +		kfree(ii_dev);
> > +		return NULL;
> > +	}
> > +
> > +	return ii_dev;
> > +}
> 
> And use:
> 
> 	to_cpumask(ii_dev->cpumask)

What's the benefit of these changes? Is it just about not allocating memory
twice or more than that ?

And what could we do in situations where we need two cpumask variables (we have
a case in cpufreq core for that) ?

-- 
viresh

  reply	other threads:[~2018-06-13  8:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 12:00 [PATCH V6] powercap/drivers/idle_injection: Add an idle injection framework Daniel Lezcano
2018-06-12 12:30 ` Peter Zijlstra
2018-06-12 12:44   ` Daniel Lezcano
2018-06-12 12:52     ` Peter Zijlstra
2018-06-12 13:02       ` Daniel Lezcano
2018-06-12 14:06         ` Peter Zijlstra
2018-06-12 14:37           ` Daniel Lezcano
2018-06-12 15:58             ` Peter Zijlstra
2018-06-12 17:02               ` Daniel Lezcano
2018-06-12 17:35                 ` Peter Zijlstra
2018-06-13  8:55                   ` Viresh Kumar
2018-06-13  9:03                     ` Daniel Lezcano
2018-06-13  9:10                       ` Viresh Kumar
2018-06-15  8:13                   ` Daniel Lezcano
2018-06-12 12:59 ` Peter Zijlstra
2018-06-13  8:24   ` Viresh Kumar [this message]
2018-06-12 14:23 ` Peter Zijlstra
2018-06-12 14:45   ` Daniel Lezcano
2018-06-12 14:26 ` Peter Zijlstra
2018-06-12 14:46   ` Daniel Lezcano
2018-06-13 15:54 ` Pandruvada, Srinivas
2018-06-13 15:54   ` Pandruvada, Srinivas
2018-06-13 20:00   ` Daniel Lezcano
2018-06-13 20:00     ` Daniel Lezcano
2018-06-13 20:07     ` Pandruvada, Srinivas
2018-06-13 20:07       ` Pandruvada, Srinivas
2018-06-13 20:19       ` Daniel Lezcano
2018-06-13 20:19         ` Daniel Lezcano
2018-06-13 20:32         ` Pandruvada, Srinivas
2018-06-13 20:32           ` Pandruvada, Srinivas
2018-06-13 20:35           ` Daniel Lezcano
2018-06-13 20:35             ` Daniel Lezcano
2018-06-13 21:27             ` Rafael J. Wysocki
2018-06-13 21:27               ` Rafael J. Wysocki

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=20180613082431.wsouzw25dx7wugni@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel.thompson@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=javi.merino@kernel.org \
    --cc=kevin.wangtao@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=vincent.guittot@linaro.org \
    /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.