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]
Message-ID: <20130704091339.GK18898@dyad.programming.kicks-ass.net>
Date:	Thu, 4 Jul 2013 11:13:39 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Michael Wang <wangyun@...ux.vnet.ibm.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...nel.org>, Mike Galbraith <efault@....de>,
	Alex Shi <alex.shi@...el.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Turner <pjt@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Nikunj A. Dadhania" <nikunj@...ux.vnet.ibm.com>,
	Ram Pai <linuxram@...ibm.com>
Subject: Re: [PATCH] sched: smart wake-affine

On Tue, Jul 02, 2013 at 05:35:33PM +0800, Michael Wang wrote:
> >> +	if (jiffies > current->last_switch_decay + HZ) {
> >> +		current->nr_wakee_switch = 0;
> >> +		current->last_switch_decay = jiffies;
> >> +	}
> > 
> > This isn't so much a decay as it is wiping state. Did you try an actual
> > decay -- something like: current->nr_wakee_switch >>= 1; ?
> > 
> > I suppose you wanted to avoid something like:
> > 
> >   now = jiffies;
> >   while (now > current->last_switch_decay + HZ) {
> >   	current->nr_wakee_switch >>= 1;
> > 	current->last_switch_decay += HZ;
> >   }
> 
> Right, actually I have though about the decay problem with some testing,
> including some similar implementations like this, but one issue I could
> not solve is:
> 
> 	the task waken up after dequeue 10secs and the task waken up
> 	after dequeue 1sec will suffer the same decay.
>
> Thus, in order to keep fair, we have to do some calculation here to make
> the decay correct, but that means cost...

Right, but something like the below is limited in cost to at most 32/64 (I
forgot the type) shifts. Now its probably not worth doing, but it shows
things like that can be done in 'constant' time.

  now = jiffies;
  if (now - p->last_switch_decay > 8*sizeof(p->nr_wakee_switch)*HZ) {
	p->nr_wakee_switch = 0;
	p->last_switch_decay = now;
  } else while (now > p->last_switch_decay + HZ) {
	p->nr_wakee_switch >>= 1;
	p->last_switch_decay += HZ;
  }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ