Re: Changing CPU frequency in atomic (schedule / scheduler_tick)
Viresh Kumar <[email protected]> Tue, 18 Aug 2015 15:57:57 +0530
| Newsgroups | org.kernel.vger.cpufreq |
|---|---|
| Message-ID | <CAOh2x=nYXetX5251oJ+RLEsMMtis=MazU+ZHzmfsY=XgvnJhXw@mail.gmail.com> |
On Tue, Aug 18, 2015 at 9:16 AM, Guru Prasad <[email protected]> wrote: > We're working on a research system where we're trying to achieve > optimal frequency selection on a per-process basis. To do so, I added > additional fields to struct task_struct to store the (computed) > optimal frequency and set it. The code that computes the optimal > frequency is calculated on every scheduler_tick(). > > I'm having trouble calling cpufreq_set_rate() from both a) > scheduler_tick() and b) schedule(). Its not just about mutex-lock. The two scheduler functions mentioned above are called from atomic context, but they can't call anything which can potentially sleep. cpufreq_set_rate() or any clk_rate_set() can potentially sleep, and so must not be called from there. Best do it from a workqueue. -- viresh