From: Danny Lin <danny@kdrag0n.dev>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Matthias Kaehlcke <mka@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Danny Lin <danny@kdrag0n.dev>
Subject: Re: [PATCH] cpufreq: Record stats when fast switching is enabled
Date: Thu, 2 Jul 2020 18:00:09 -0700 [thread overview]
Message-ID: <20200703010009.220363-1-danny@kdrag0n.dev> (raw)
In-Reply-To: <3268787.3OZuCagV1k@aspire.rjw.lan>
On Thu, Jan 31, 2019 at 2:14 AM, Rafael J. Wysocki wrote:
> On Thu, Jan 31, 2019 at 11:07 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > On 31-01-19, 11:03, Rafael J. Wysocki wrote:
> > > On Thu, Jan 31, 2019 at 9:30 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > > >
> > > > The only problem that I can think of (or recall) is that this routine
> > > > also gets called when time_in_state sysfs file is read and that can
> > > > end up taking lock which the scheduler's hotpath will wait for.
> > >
> > > What about the extra locking overhead in the scheduler context?
> >
> > What about using READ_ONCE/WRITE_ONCE here ? Not sure if we really
> > need locking in this particular case.
>
> If that works, then fine, but ISTR some synchronization issues related to that.
Maybe using READ/WRITE_ONCE for time_in_state is problematic, but is
there any reason why atomics wouldn't work for this? As far as I can
tell, atomics are necessary to protect time_in_state due to its
multi-step add operation, and READ/WRITE_ONCE can be used for last_time
because all operations on it are single-op sets/gets.
I've been using the setup described above on a downstream arm64 4.14
kernel for nearly a year with no issues. I haven't noticed any
significant anomalies in the stats so far. The system in question has 8
CPUs split into 3 cpufreq policies and fast switch is used with the
schedutil governor, so it should be exercising the stats update path
enough.
Sorry for bumping an old thread.
next prev parent reply other threads:[~2020-07-03 1:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 1:51 Matthias Kaehlcke
2019-01-31 8:30 ` Viresh Kumar
2019-01-31 10:03 ` Rafael J. Wysocki
2019-01-31 10:07 ` Viresh Kumar
2019-01-31 10:14 ` Rafael J. Wysocki
2019-01-31 18:37 ` Matthias Kaehlcke
2019-01-31 23:34 ` Rafael J. Wysocki
2019-02-01 0:06 ` Matthias Kaehlcke
2020-07-03 1:00 ` Danny Lin [this message]
2019-01-31 10:02 ` 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=20200703010009.220363-1-danny@kdrag0n.dev \
--to=danny@kdrag0n.dev \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@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
all inboxes | Powered by JetHome®