From: Kirill Tkhai <ktkhai@parallels.com>
To: <bsegall@google.com>
Cc: <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Kirill Tkhai <tkhai@yandex.ru>
Subject: Re: [PATCH] sched/fair: Make cfs_rq::decay_counter non-atomic
Date: Wed, 17 Dec 2014 12:09:33 +0300 [thread overview]
Message-ID: <1418807373.6074.18.camel@tkhai> (raw)
In-Reply-To: <xm26iohb79v5.fsf@sword-of-the-dawn.mtv.corp.google.com>
В Вт, 16/12/2014 в 10:00 -0800, bsegall@google.com пишет:
> Kirill Tkhai <ktkhai@parallels.com> writes:
>
> > We update decay_counter in update_cfs_rq_blocked_load()
> > only. This function is always called with rq lock locked,
> > so we can kill atomic actions.
> >
> > Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
> > ---
> > kernel/sched/fair.c | 11 ++++++-----
> > kernel/sched/sched.h | 2 +-
> > 2 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 5f3b5a7..af990c4 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -2570,7 +2570,7 @@ static __always_inline int __update_entity_runnable_avg(u64 now,
> > static inline u64 __synchronize_entity_decay(struct sched_entity *se)
> > {
> > struct cfs_rq *cfs_rq = cfs_rq_of(se);
> > - u64 decays = atomic64_read(&cfs_rq->decay_counter);
> > + u64 decays = ACCESS_ONCE(cfs_rq->decay_counter);
>
> This is called without rq lock held from migrate_task_rq_fair. (We could
> technically change the atomic_add to atomic64_set(atomic64_read() + x),
> but I don't know that that is a win) Now, we could do a
> min_vruntime-style two-copy thing if this atomic usage is a hot spot on
> 32-bit, we just didn't bother initially.
Oh, I forgot that 64-bit read is not everywhere atomic... Thanks, Ben.
Peter, please, ignore this patch.
prev parent reply other threads:[~2014-12-17 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 14:25 Kirill Tkhai
2014-12-16 14:28 ` Kirill Tkhai
2014-12-16 18:00 ` bsegall
2014-12-17 9:09 ` Kirill Tkhai [this message]
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=1418807373.6074.18.camel@tkhai \
--to=ktkhai@parallels.com \
--cc=bsegall@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tkhai@yandex.ru \
/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®