From: Peter Zijlstra <peterz@infradead.org>
To: subhra mazumdar <subhra.mazumdar@oracle.com>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com
Subject: Re: [RFC PATCH] sched: Improve scalability of select_idle_sibling using SMT balance
Date: Tue, 19 Dec 2017 20:36:48 +0100 [thread overview]
Message-ID: <20171219193648.55oxgpbosruavlby@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20171208200754.4738-1-subhra.mazumdar@oracle.com>
On Fri, Dec 08, 2017 at 12:07:54PM -0800, subhra mazumdar wrote:
> +static inline void
> +sd_context_switch(struct sched_domain *sd, struct rq *rq, int util)
> +{
> + struct sched_group *sg_cpu;
> +
> + /* atomically add/subtract the util */
> + sg_cpu = sd->sg_cpu;
> + if (util > 0)
> + atomic_inc(
> + (atomic_t *)(&(sg_cpu->utilization)));
> + else
> + atomic_dec(
> + (atomic_t *)(&(sg_cpu->utilization)));
Whahah, lol, no!
> +}
> +
> /*
> * context_switch - switch to the new MM and the new thread's register state.
> */
> @@ -2751,6 +2766,51 @@ context_switch(struct rq *rq, struct task_struct *prev,
> struct task_struct *next, struct rq_flags *rf)
> {
> struct mm_struct *mm, *oldmm;
> + int this_cpu = rq->cpu;
> + struct sched_domain *sd;
> + unsigned int cond;
> +
> + cond = ((prev != rq->idle) << 1) | (next != rq->idle);
> + sd = rcu_dereference(per_cpu(sd_llc, this_cpu));
That one is RCU, not RCU-sched protected..
> + /*
> + * From sd_llc downward update the SMT utilization.
> + * Skip the lowest level 0.
> + */
> + for_each_lower_domain(sd) {
> + if (sd->level == 0)
> + break;
> + if (rq->initial_util == UTIL_UNINITIALIZED) {
> + switch (cond) {
> + case PREV_IDLE_NEXT_NIDLE:
> + case PREV_NIDLE_NEXT_NIDLE:
> + sd_context_switch(sd, rq, SMT_THREAD_UTIL);
> + break;
> + case PREV_NIDLE_NEXT_IDLE:
> + case PREV_IDLE_NEXT_IDLE:
> + break;
> + }
> + } else {
> + switch (cond) {
> + case PREV_IDLE_NEXT_NIDLE:
> + sd_context_switch(sd, rq, SMT_THREAD_UTIL);
> + break;
> + case PREV_NIDLE_NEXT_IDLE:
> + sd_context_switch(sd, rq, -SMT_THREAD_UTIL);
> + break;
> + case PREV_IDLE_NEXT_IDLE:
> + case PREV_NIDLE_NEXT_NIDLE:
> + break;
> + }
> + }
> + }
> +
> + if (sd) {
> + if (next == rq->idle)
> + rq->initial_util = UTIL_IDLE;
> + else
> + rq->initial_util = UTIL_BUSY;
> + }
WTH do you even think this is reasonable?
> prepare_task_switch(rq, prev, next);
>
And I still have no idea what the patch does, but I can't be bothered to
reverse engineer it just now.
next prev parent reply other threads:[~2017-12-19 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 20:07 subhra mazumdar
2017-12-19 19:36 ` Peter Zijlstra [this message]
2017-12-20 22:19 ` Subhra Mazumdar
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=20171219193648.55oxgpbosruavlby@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=subhra.mazumdar@oracle.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 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®