diff mbox

drm/i915: Optimize DIV_ROUND_CLOSEST call

Message ID 20121112141802.6326e589@endymion.delvare (mailing list archive)
State New, archived
Headers show

Commit Message

Jean Delvare Nov. 12, 2012, 1:18 p.m. UTC
DIV_ROUND_CLOSEST is faster if the compiler knows it will only be
dealing with unsigned dividends. This optimization rips 32 bytes of
binary code on x86_64.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
Already sent on: 2012-09-03.

Daniel, I think we can safely assume ia_freq can't be negative?

 drivers/gpu/drm/i915/intel_pm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 12, 2012, 2:02 p.m. UTC | #1
On Mon, Nov 12, 2012 at 02:18:02PM +0100, Jean Delvare wrote:
> DIV_ROUND_CLOSEST is faster if the compiler knows it will only be
> dealing with unsigned dividends. This optimization rips 32 bytes of
> binary code on x86_64.
> 
> Signed-off-by: Jean Delvare <khali@linux-fr.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> ---
> Already sent on: 2012-09-03.
> 
> Daniel, I think we can safely assume ia_freq can't be negative?

Queued for -next, thanks for the patch. Sorry that I've missed it on first
submission.
-Daniel
Jean Delvare Nov. 12, 2012, 2:12 p.m. UTC | #2
On Mon, 12 Nov 2012 15:02:26 +0100, Daniel Vetter wrote:
> On Mon, Nov 12, 2012 at 02:18:02PM +0100, Jean Delvare wrote:
> > DIV_ROUND_CLOSEST is faster if the compiler knows it will only be
> > dealing with unsigned dividends. This optimization rips 32 bytes of
> > binary code on x86_64.
> > 
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: David Airlie <airlied@linux.ie>
> > ---
> > Already sent on: 2012-09-03.
> > 
> > Daniel, I think we can safely assume ia_freq can't be negative?
> 
> Queued for -next, thanks for the patch. Sorry that I've missed it on first
> submission.

No problem, thanks :)
diff mbox

Patch

--- linux-3.7-rc5.orig/drivers/gpu/drm/i915/intel_pm.c	2012-11-12 09:30:56.796836818 +0100
+++ linux-3.7-rc5/drivers/gpu/drm/i915/intel_pm.c	2012-11-12 10:49:38.241676096 +0100
@@ -2547,7 +2547,8 @@  static void gen6_update_ring_freq(struct
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int min_freq = 15;
-	int gpu_freq, ia_freq, max_ia_freq;
+	int gpu_freq;
+	unsigned int ia_freq, max_ia_freq;
 	int scaling_factor = 180;
 
 	WARN_ON(!mutex_is_locked(&dev->struct_mutex));