public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Align the retire_requests worker to the nearest second
Date: Fri, 05 Oct 2012 16:55:29 +0100	[thread overview]
Message-ID: <275ffc$6saak7@fmsmga002.fm.intel.com> (raw)
In-Reply-To: <506EFA39.4040902@linux.intel.com>

On Fri, 05 Oct 2012 08:18:17 -0700, Arjan van de Ven <arjan@linux.intel.com> wrote:
> On 10/5/2012 6:53 AM, Chris Wilson wrote:
> > By using round_jiffies() we can align the wakeup of our worker to the
> > nearest second in order to batch wakeups and reduce system load, which
> > is useful for unimportant coarse tasks like our retire_requests.
> > 
> > Suggested-by: Arjan van de Ven <arjan@linux.intel.com>
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Arjan van de Ven <arjan@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c |   14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 8e05d53..706f481 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -2084,6 +2084,11 @@ i915_gem_next_request_seqno(struct intel_ring_buffer *ring)
> >  	return ring->outstanding_lazy_request;
> >  }
> >  
> > +static unsigned long round_jiffies_delay(unsigned long delay)
> > +{
> > +	return round_jiffies_relative(delay) - jiffies;
> > +}
> 
> this is buggy
> 
> 
> > +
> >  int
> >  i915_add_request(struct intel_ring_buffer *ring,
> >  		 struct drm_file *file,
> > @@ -2155,7 +2160,8 @@ i915_add_request(struct intel_ring_buffer *ring,
> >  		}
> >  		if (was_empty) {
> >  			queue_delayed_work(dev_priv->wq,
> > -					   &dev_priv->mm.retire_work, HZ);
> > +					   &dev_priv->mm.retire_work,
> > +					   round_jiffies_delay(HZ));
> 
> when used like this
> 
> 
> round_jiffies() rounds absolute jiffies towards the next second
> 
> round_jiffies_relative() already subtracts jiffies from the result, like
> the helper that you're trying to invent here does ;=)
> 
> doing that double up is a bad idea.

For some reason the example I read convinced me that
round_jiffies_relative() returned the absolute jiffie for the relative
delay so that we could put it straight into mod_timer().

Again we can use round up here as well.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

  reply	other threads:[~2012-10-05 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-05 13:53 [PATCH 1/2] drm/i915: Align the hangcheck wakeup to the nearest second Chris Wilson
2012-10-05 13:53 ` [PATCH 2/2] drm/i915: Align the retire_requests worker " Chris Wilson
2012-10-05 15:18   ` Arjan van de Ven
2012-10-05 15:55     ` Chris Wilson [this message]
2012-10-05 16:22   ` Jani Nikula
2012-10-05 15:40 ` [PATCH 1/2] drm/i915: Align the hangcheck wakeup " Jani Nikula
2012-10-05 15:51   ` Chris Wilson
2012-10-05 16:02 ` Chris Wilson
2012-10-05 16:02   ` [PATCH 2/2] drm/i915: Align the retire_requests worker " Chris Wilson
2012-10-08 10:59   ` [PATCH 1/2] drm/i915: Align the hangcheck wakeup " Jani Nikula
2012-10-08 16:46     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='275ffc$6saak7@fmsmga002.fm.intel.com' \
    --to=chris@chris-wilson.co.uk \
    --cc=arjan@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox