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:	Thu, 15 May 2008 20:32:30 +0530
From:	Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>
To:	Gautham R Shenoy <ego@...ibm.com>
Cc:	Ingo Molnar <mingo@...e.hu>, npiggin@...e.de,
	linux-kernel@...r.kernel.org, Srivatsa Vaddagiri <vatsa@...ibm.com>
Subject: Re: [PATCH] sched: Improve readability in update_cpu_load() code

On Thu, May 15, 2008 at 08:22:15PM +0530, Srivatsa Vaddagiri wrote:
> This wont work when new_load < old_load ..
> 
> For ex: I tried this prog:
> 
> #include <stdio.h>
> 
> main()
> {
> 	unsigned long old_load = 100, new_load = 90, this_load, this_load1;
> 	int i = 1, scale = 2 << i;

s/scale = 2<< i/scale = 2 << (i-1)

> 
> 	this_load = (old_load*(scale-1) + new_load) >> i;
> 	this_load1 = old_load + ((new_load - old_load) >> i);
> 
> 	printf ("this_load = %u, this_load1 = %u \n", this_load, this_load1);
> }
> 
> This is what I get:
> 
> $ ./a.out
> this_load = 195, this_load1 = 2147483743
> $

[with above modification:]

this_load = 95, this_load1 = 2147483743


-- 
Regards,
vatsa
--
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