lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Dec 2017 20:36:48 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     subhra mazumdar <subhra.mazumdar@...cle.com>
Cc:     linux-kernel@...r.kernel.org, mingo@...hat.com
Subject: Re: [RFC PATCH] sched: Improve scalability of select_idle_sibling
 using SMT balance

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ