From: Ben Widawsky Subject: Re: [PATCH 1/3] drm/i915: Keep track of request counts Date: Sat, 29 Oct 2011 12:30:11 -0700 Message-ID: <20111029123011.29e8ea5a@bwidawsk.net> References: <1319867729-8676-1-git-send-email-ben@bwidawsk.net> <1319867729-8676-2-git-send-email-ben@bwidawsk.net> <20111029093513.GA2932@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CCAF9E7DB for ; Sat, 29 Oct 2011 12:30:19 -0700 (PDT) In-Reply-To: <20111029093513.GA2932@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Sat, 29 Oct 2011 11:35:13 +0200 Daniel Vetter wrote: > On Fri, Oct 28, 2011 at 10:55:27PM -0700, Ben Widawsky wrote: > > There is already a list of requests outstanding for a given client. > > Keeping a count is easy, and will give some information necessary to > > enable a more fair throttling scheme. > > > > For now a client is uniquely identified by its file descriptor, however > > this may change in the future with new process APIs. > > > > Signed-off-by: Ben Widawsky > > --- > > drivers/gpu/drm/i915/i915_drv.h | 1 + > > drivers/gpu/drm/i915/i915_gem.c | 8 ++++++++ > > 2 files changed, 9 insertions(+), 0 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > > index 06a37f4..a251d22 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.h > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > @@ -919,6 +919,7 @@ struct drm_i915_file_private { > > struct { > > struct spinlock lock; > > struct list_head request_list; > > + atomic_t outstanding_requests; > > Here's your bikeshed: > > Is the spinlock not sufficient to protect the count? I'm asking because > atomic_ts are pretty hard to extend to more fancy scheme (e.g. taking > actual gpu time into account or comparing this with other processes > outstanding_request to make better decisions). > -Daniel In a previous version, I set the oustanding count to 0 without holding the lock in i915_gem_release. In what I sent to the list, it seems the atomic isn't actually needed.