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, 24 Mar 2015 21:22:07 +0100
From:	"Rafael J. Wysocki" <rjw@...ysocki.net>
To:	Javi Merino <javi.merino@....com>
Cc:	akpm@...ux-foundation.org, intel-gfx@...ts.freedesktop.org,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	emil.l.velikov@...il.com, jepler@...ythonic.net, daniel@...ll.ch,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Mel Gorman <mgorman@...e.de>,
	Stephen Hemminger <shemminger@...ux-foundation.org>
Subject: Re: [PATCH v2 3/4] cpuidle: menu: use DIV_ROUND_CLOSEST_ULL()

On Tuesday, March 24, 2015 02:03:44 PM Javi Merino wrote:
> Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal
> implementation and use the kernel one.

Can you please CC patch [1/4] to me too at least, so I can see how the new
macro is defined without digging it up from the entire firehose of messages
which is the LKML today?

> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
> Cc: Mel Gorman <mgorman@...e.de>
> Cc: Stephen Hemminger <shemminger@...ux-foundation.org>
> Signed-off-by: Javi Merino <javi.merino@....com>
> ---
>  drivers/cpuidle/governors/menu.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 40580794e23d..b8a5fa15ca24 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -190,12 +190,6 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices);
>  
>  static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev);
>  
> -/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
> -static u64 div_round64(u64 dividend, u32 divisor)
> -{
> -	return div_u64(dividend + (divisor / 2), divisor);
> -}
> -
>  /*
>   * Try detecting repeating patterns by keeping track of the last 8
>   * intervals, and checking if the standard deviation of that set
> @@ -317,7 +311,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
>  	 * operands are 32 bits.
>  	 * Make sure to round up for half microseconds.
>  	 */
> -	data->predicted_us = div_round64((uint64_t)data->next_timer_us *
> +	data->predicted_us = DIV_ROUND_CLOSEST_ULL((uint64_t)data->next_timer_us *
>  					 data->correction_factor[data->bucket],
>  					 RESOLUTION * DECAY);
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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