Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Volkin, Bradley D" <bradley.d.volkin@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [RFC 1/4] drm/i915: Implement a framework for batch buffer pools
Date: Fri, 20 Jun 2014 09:06:06 -0700	[thread overview]
Message-ID: <20140620160606.GA24185@bdvolkin-ubuntu-desktop> (raw)
In-Reply-To: <53A45614.3070406@linux.intel.com>

On Fri, Jun 20, 2014 at 08:41:08AM -0700, Tvrtko Ursulin wrote:
> 
> On 06/20/2014 04:30 PM, Volkin, Bradley D wrote:
> > On Fri, Jun 20, 2014 at 06:25:56AM -0700, Tvrtko Ursulin wrote:
> >>
> >> On 06/19/2014 06:35 PM, Volkin, Bradley D wrote:
> >>> On Thu, Jun 19, 2014 at 02:48:29AM -0700, Tvrtko Ursulin wrote:
> >>>>
> >>>> Hi Brad,
> >>>>
> >>>> On 06/18/2014 05:36 PM, bradley.d.volkin@intel.com wrote:
> >> Cap or no cap (I am for no cap), but the pool is still "grow only" at
> >> the moment, no? So one allocation storm and objects on the pool inactive
> >> list end up wasting memory forever.
> >
> > Oh, so what happens is that when you put() an object back in the pool, we
> > set obj->madv = I915_MADV_DONTNEED, which should tell the shrinker that it
> > can drop the backing storage for the object if we need space. When you get()
> > an object, we set obj->madv = I915_MADV_WILLNEED and get new backing pages.
> > So the number of objects grows (capped or not), but the memory used can be
> > controlled.
> 
> Education time for me I see. :)
> 
> So the object is in pool->inactive_list _and_ in some other list so 
> shrinker can find it?

Yes. In fact, they are on several other lists. Here's my understanding:

The dev_priv->mm struct has bound_list and unbound_list, which track which
objects are or are not bound in some gtt. The shrinker operates on these
lists to drop backing storage when we need physical space. The pool objects
are added to these lists when we explicitly call ggtt_pin() and  when the
object eventually gets an unbind().

The ring structs have an active_list, which track objects that are used by
work still in progress on that ring. The i915_address_space structs have an
inactive_list, which contains vmas that are bound in that address space but
are not used by work still in progress. The driver uses these to evict
objects in a given gtt/ppgtt when we need GPU virtual address space. We
explicitly put a pool object's vma on the active_list with a move_to_active()
call at the end of do_execbuffer(). Retiring requests moves it to the
appropriate i915_address_space inactive_list.

Brad

> 
> Thanks,
> 
> Tvrtko

  reply	other threads:[~2014-06-20 16:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 16:36 [RFC 0/4] Command parser batch buffer copy bradley.d.volkin
2014-06-18 16:36 ` [RFC 1/4] drm/i915: Implement a framework for batch buffer pools bradley.d.volkin
2014-06-19  9:48   ` Tvrtko Ursulin
2014-06-19 17:35     ` Volkin, Bradley D
2014-06-19 19:07       ` Daniel Vetter
2014-06-20 13:25       ` Tvrtko Ursulin
2014-06-20 15:30         ` Volkin, Bradley D
2014-06-20 15:41           ` Tvrtko Ursulin
2014-06-20 16:06             ` Volkin, Bradley D [this message]
2014-06-18 16:36 ` [RFC 2/4] drm/i915: Use batch pools with the command parser bradley.d.volkin
2014-06-18 16:52   ` Chris Wilson
2014-06-18 17:49     ` Volkin, Bradley D
2014-06-18 18:11       ` Chris Wilson
2014-06-18 19:59         ` Daniel Vetter
2014-06-18 16:36 ` [RFC 3/4] drm/i915: Add a batch pool debugfs file bradley.d.volkin
2014-06-18 16:36 ` [RFC 4/4] drm/i915: Dispatch the shadow batch buffer bradley.d.volkin

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=20140620160606.GA24185@bdvolkin-ubuntu-desktop \
    --to=bradley.d.volkin@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    /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