All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuyang Du <yuyang.du@intel.com>
To: bsegall@google.com
Cc: Morten Rasmussen <morten.rasmussen@arm.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"pjt@google.com" <pjt@google.com>,
	"arjan.van.de.ven@intel.com" <arjan.van.de.ven@intel.com>,
	"len.brown@intel.com" <len.brown@intel.com>,
	"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"alan.cox@intel.com" <alan.cox@intel.com>,
	"mark.gross@intel.com" <mark.gross@intel.com>,
	"fengguang.wu@intel.com" <fengguang.wu@intel.com>,
	"umgwanakikbuti@gmail.com" <umgwanakikbuti@gmail.com>
Subject: Re: [PATCH 2/2 v3] sched: Rewrite per entity runnable load average tracking
Date: Thu, 17 Jul 2014 05:22:02 +0800	[thread overview]
Message-ID: <20140716212202.GB2901@intel.com> (raw)
In-Reply-To: <xm26lhrtw2xo.fsf@sword-of-the-dawn.mtv.corp.google.com>

On Wed, Jul 16, 2014 at 11:53:23AM -0700, bsegall@google.com wrote:
> Morten Rasmussen <morten.rasmussen@arm.com> writes:
> 
> > On Wed, Jul 16, 2014 at 02:50:47AM +0100, Yuyang Du wrote:
> >
> > [...]
> >
> >> +/*
> >> + * Update load_avg of the cfs_rq along with its own se. They should get
> >> + * synchronized: group se's load_avg is used for task_h_load calc, and
> >> + * group cfs_rq's load_avg is used for task_h_load (and update_cfs_share
> >> + * calc).
> >> + */
> >> +static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
> >>  {
> >> -       long old_contrib = se->avg.load_avg_contrib;
> >> +       int decayed;
> >> 
> >> -       if (entity_is_task(se)) {
> >> -               __update_task_entity_contrib(se);
> >> -       } else {
> >> -               __update_tg_runnable_avg(&se->avg, group_cfs_rq(se));
> >> -               __update_group_entity_contrib(se);
> >> +       if (atomic_long_read(&cfs_rq->removed_load_avg)) {
> >> +               long r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
> >> +               cfs_rq->avg.load_avg = subtract_until_zero(cfs_rq->avg.load_avg, r);
> >> +               r *= LOAD_AVG_MAX;
> >> +               cfs_rq->avg.load_sum = subtract_until_zero(cfs_rq->avg.load_sum, r);
> >>         }
> >> 
> >> -       return se->avg.load_avg_contrib - old_contrib;
> >> -}
> >> +       decayed = __update_load_avg(now, &cfs_rq->avg, cfs_rq->load.weight);
> >> +#ifndef CONFIG_64BIT
> >> +       if (cfs_rq->avg.last_update_time != cfs_rq->load_last_update_time_copy)
> >> +               sa_q->last_update_time_copy = sa_q->last_update_time;
> >
> > to make it build. But I'm not convinced that this synchronization is
> > right.
> >
> > First let me say that I'm not an expert on synchronization. It seems to
> > me that there is nothing preventing reordering of the writes in
> > __update_load_avg() which sets cfs_rq->avg.last_update_time and the
> > update of cfs_rq->avg.load_last_update_time_copy.
> 
> You're correct, this needs to be if(...) { smp_wmb(); copy = time; },
> the same as update_min_vruntime.

Ok, I will get the barrier back. Thanks, Morten and Ben.

Yuyang

      reply	other threads:[~2014-07-17  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-16  1:50 [PATCH 0/2 v3] sched: Rewrite per entity runnable load average tracking Yuyang Du
2014-07-16  1:50 ` [PATCH 1/2 v3] sched: Remove update_rq_runnable_avg Yuyang Du
2014-07-16  1:50 ` [PATCH 2/2 v3] sched: Rewrite per entity runnable load average tracking Yuyang Du
2014-07-16 15:46   ` Morten Rasmussen
2014-07-16 18:53     ` bsegall
2014-07-16 21:22       ` Yuyang Du [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=20140716212202.GB2901@intel.com \
    --to=yuyang.du@intel.com \
    --cc=alan.cox@intel.com \
    --cc=arjan.van.de.ven@intel.com \
    --cc=bsegall@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.gross@intel.com \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=umgwanakikbuti@gmail.com \
    /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.