From: Morten Rasmussen <morten.rasmussen@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
"markgross@thegnar.org" <markgross@thegnar.org>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
Catalin Marinas <Catalin.Marinas@arm.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [8/11] use-case 2: Audio playback on Android
Date: Tue, 7 Jan 2014 15:55:33 +0000 [thread overview]
Message-ID: <20140107155533.GB3000@e103034-lin> (raw)
In-Reply-To: <20140107121500.GR30183@twins.programming.kicks-ass.net>
On Tue, Jan 07, 2014 at 12:15:00PM +0000, Peter Zijlstra wrote:
> On Fri, Dec 20, 2013 at 04:45:48PM +0000, Morten Rasmussen wrote:
> > Audio playback is a low load periodic application that has little/no
> > variation in period and load over time. It consists of tasks involved in
> > decoding the audio stream and communicating with audio frameworks and
> > drivers.
> >
> > Performance Criteria
> >
> > All tasks must have completed before the next request to fill the audio
> > buffer. Most modern hardware should be able to deal with the load even
> > at the lowest P-state.
> >
> > Task behaviour
> >
> > The task load pattern period is dictated by the audio interrupt. On an
> > example modern ARM based system this occurs every ~6 ms. The decoding
> > work is triggered every fourth interrupt, i.e. a ~24 ms period. No tasks
> > are scheduled at the intermediate interrupts. The tasks involved are:
> >
> > Main audio framework task (AudioOut): The first task to be scheduled
> > after the interrupt and continues running until decoding has completed.
> > That is ~5 ms. Runs at nice=-19.
> >
> > Audio framework task 2 (AudioTrack): Woken up by the main task ~250-300
> > us after the main audio task is scheduled. Runs for ~300 us at nice=-16.
> >
> > Decoder task (mp3.decoder): Woken up by the audio task 2 when that
> > finishes (serialized). Runs for ~1 ms until it wakes a third Android
> > task on which it blocks and continues for another ~150 us afterwards
> > (serialized). Runs at nice=-2.
> >
> > Android task 3 (OMXCallbackDisp): Woken by decoder task. Runs for ~300
> > us at nice=-2.
>
> I probably shouldn't ask; but..
>
> Why would the AudioOut task keep running while waiting for the
> mp3.decoder thing to provide content? That doesn't make sense.
>
> One would expect something simple like:
>
> DMA buffer reaches low mark, sends interrupt, interrupt wakes task, task fills
> up buffer, goto 1.
>
> Instead we get this merry dance of far too many tasks.
>
> And even if you want to add mixing multiple streams in software (and do
> not optimize the single active stream) and you want to do this with
> multiple tasks instead of chaining calls in the same task, you still
> get a normal blocking task chain with at most 1 runnable task.
>
> Something seems fucked with Android if it needs more than 1 running task
> to fill an audio buffer.
I'm not an Android internals expert so I won't try to defend why it is
like that. I did the descriptions by starring at ftrace output and tried
to figure out the task dependencies. These become fairly clear when
changing the number of cpus online so the scheduling patterns changes.
Not helping much, I know.
next prev parent reply other threads:[~2014-01-07 15:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 16:45 [0/11] Energy-aware scheduling use-cases and scheduler issues Morten Rasmussen
2013-12-20 16:45 ` [1/11] issue 1: Missing power topology information in scheduler Morten Rasmussen
2013-12-22 15:19 ` mark gross
2013-12-30 14:00 ` Morten Rasmussen
2014-01-13 20:23 ` Rafael J. Wysocki
2014-01-14 16:21 ` Morten Rasmussen
2014-01-14 17:09 ` Peter Zijlstra
2013-12-20 16:45 ` [2/11] issue 2: Energy-awareness for heterogeneous systems Morten Rasmussen
2013-12-20 16:45 ` [3/11] issue 3: No understanding of potential cpu capacity Morten Rasmussen
2013-12-20 16:45 ` [4/11] issue 4: Tracking idle states Morten Rasmussen
2013-12-20 16:45 ` [5/11] issue 5: Frequency and uarch invariant task load Morten Rasmussen
2013-12-20 16:45 ` [6/11] issue 6: Poor and non-deterministic performance on heterogeneous systems Morten Rasmussen
2013-12-20 16:45 ` [7/11] use-case 1: Webbrowsing on Android Morten Rasmussen
2013-12-20 16:45 ` [8/11] use-case 2: Audio playback " Morten Rasmussen
2014-01-07 12:15 ` Peter Zijlstra
2014-01-07 12:16 ` Peter Zijlstra
2014-01-07 16:02 ` Morten Rasmussen
2014-01-07 15:55 ` Morten Rasmussen [this message]
2013-12-20 16:45 ` [9/11] use-case 3: Video " Morten Rasmussen
2013-12-20 16:45 ` [10/11] use-case 4: Game " Morten Rasmussen
2013-12-20 16:45 ` [11/11] system 1: Saving energy using DVFS Morten Rasmussen
2013-12-22 16:28 ` [0/11] Energy-aware scheduling use-cases and scheduler issues mark gross
2013-12-30 12:10 ` Morten Rasmussen
2014-01-12 16:47 ` mark gross
2014-01-13 12:04 ` Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2014-01-07 16:19 [0/11][REPOST] " Morten Rasmussen
2014-01-07 16:19 ` [8/11] use-case 2: Audio playback on Android Morten Rasmussen
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=20140107155533.GB3000@e103034-lin \
--to=morten.rasmussen@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=linux-pm@vger.kernel.org \
--cc=markgross@thegnar.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox