All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Martin Kepplinger <martink@posteo.de>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	daniel.vetter@intel.com, Dave Airlie <airlied@gmail.com>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/5] i915: fence workqueue optimization
Date: Fri, 7 Apr 2017 15:13:58 +0200	[thread overview]
Message-ID: <20170407131358.GB5035@redhat.com> (raw)
In-Reply-To: <20170407095838.GF10496@nuc-i3427.alporthouse.com>

On Fri, Apr 07, 2017 at 10:58:38AM +0100, Chris Wilson wrote:
> On Fri, Apr 07, 2017 at 01:23:47AM +0200, Andrea Arcangeli wrote:
> > Insist to run llist_del_all() until the free_list is found empty, this
> > may avoid having to schedule more workqueues.
> 
> The work will already be scheduled (everytime we add the first element,
> the work is scheduled, and the scheduled bit is cleared before the work
> is executed). So we aren't saving the kworker from having to process
> another work, but we may make that having nothing to do. The question is
> whether we want to trap the kworker here, and presumably you will also want
> to add a cond_resched() between passes.

Yes it is somewhat dubious in the two event only case, but it will
save kworker in case of more events if there is a flood of
llist_add. It just looked fast enough but it's up to you, it's a
cmpxchg more for each intel_atomic_helper_free_state. If it's unlikely
more work is added, it's better to drop it. Agree about
cond_resched() if we keep it.

The same issue exists in __i915_gem_free_work, but I guess it's more
likely there that by the time __i915_gem_free_objects returns the
free_list isn't empty anymore because __i915_gem_free_objects has a
longer runtime but then you may want to re-evaluate that too as it's
slower for the two llist_add in a row case and only pays off from the
third.

	while ((freed = llist_del_all(&i915->mm.free_list)))
		__i915_gem_free_objects(i915, freed);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Andrea Arcangeli <aarcange@redhat.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Martin Kepplinger <martink@posteo.de>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	daniel.vetter@intel.com, Dave Airlie <airlied@gmail.com>,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/5] i915: fence workqueue optimization
Date: Fri, 7 Apr 2017 15:13:58 +0200	[thread overview]
Message-ID: <20170407131358.GB5035@redhat.com> (raw)
In-Reply-To: <20170407095838.GF10496@nuc-i3427.alporthouse.com>

On Fri, Apr 07, 2017 at 10:58:38AM +0100, Chris Wilson wrote:
> On Fri, Apr 07, 2017 at 01:23:47AM +0200, Andrea Arcangeli wrote:
> > Insist to run llist_del_all() until the free_list is found empty, this
> > may avoid having to schedule more workqueues.
> 
> The work will already be scheduled (everytime we add the first element,
> the work is scheduled, and the scheduled bit is cleared before the work
> is executed). So we aren't saving the kworker from having to process
> another work, but we may make that having nothing to do. The question is
> whether we want to trap the kworker here, and presumably you will also want
> to add a cond_resched() between passes.

Yes it is somewhat dubious in the two event only case, but it will
save kworker in case of more events if there is a flood of
llist_add. It just looked fast enough but it's up to you, it's a
cmpxchg more for each intel_atomic_helper_free_state. If it's unlikely
more work is added, it's better to drop it. Agree about
cond_resched() if we keep it.

The same issue exists in __i915_gem_free_work, but I guess it's more
likely there that by the time __i915_gem_free_objects returns the
free_list isn't empty anymore because __i915_gem_free_objects has a
longer runtime but then you may want to re-evaluate that too as it's
slower for the two llist_add in a row case and only pays off from the
third.

	while ((freed = llist_del_all(&i915->mm.free_list)))
		__i915_gem_free_objects(i915, freed);

  reply	other threads:[~2017-04-07 13:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22  8:38 [BUG][REGRESSION] i915 gpu hangs under load Martin Kepplinger
2017-03-22 10:36 ` Jani Nikula
2017-03-22 10:36   ` [Intel-gfx] " Jani Nikula
2017-04-02 11:50   ` Thorsten Leemhuis
2017-04-02 11:50     ` [Intel-gfx] " Thorsten Leemhuis
2017-04-02 12:13     ` Martin Kepplinger
2017-04-02 12:13       ` [Intel-gfx] " Martin Kepplinger
2017-04-03 15:09       ` Jani Nikula
2017-04-03 15:09         ` Jani Nikula
2017-04-06 23:23         ` [PATCH 0/5] " Andrea Arcangeli
2017-04-06 23:23           ` [PATCH 0/5] Re: [Intel-gfx] " Andrea Arcangeli
2017-04-06 23:23           ` [PATCH 1/5] i915: avoid kernel hang caused by synchronize rcu struct_mutex deadlock Andrea Arcangeli
2017-04-06 23:23             ` Andrea Arcangeli
2017-04-07  9:05             ` [Intel-gfx] " Joonas Lahtinen
2017-04-07  9:05               ` Joonas Lahtinen
2017-04-06 23:23           ` [PATCH 2/5] i915: flush gem obj freeing workqueues to add accuracy to the i915 shrinker Andrea Arcangeli
2017-04-06 23:23             ` Andrea Arcangeli
2017-04-07 10:02             ` Chris Wilson
2017-04-07 10:02               ` Chris Wilson
2017-04-07 13:06               ` Andrea Arcangeli
2017-04-07 13:06                 ` Andrea Arcangeli
2017-04-07 15:30                 ` Chris Wilson
2017-04-07 15:30                   ` Chris Wilson
2017-04-07 16:48                   ` Andrea Arcangeli
2017-04-07 16:48                     ` Andrea Arcangeli
2017-04-10  9:39                     ` Chris Wilson
2017-04-10  9:39                       ` Chris Wilson
2017-04-06 23:23           ` [PATCH 3/5] i915: initialize the free_list of the fencing atomic_helper Andrea Arcangeli
2017-04-06 23:23             ` Andrea Arcangeli
2017-04-07 10:35             ` Chris Wilson
2017-04-07 10:35               ` Chris Wilson
2017-04-06 23:23           ` [PATCH 4/5] i915: schedule while freeing the lists of gem objects Andrea Arcangeli
2017-04-06 23:23             ` Andrea Arcangeli
2017-04-06 23:23           ` [PATCH 5/5] i915: fence workqueue optimization Andrea Arcangeli
2017-04-06 23:23             ` Andrea Arcangeli
2017-04-07  9:58             ` Chris Wilson
2017-04-07  9:58               ` Chris Wilson
2017-04-07 13:13               ` Andrea Arcangeli [this message]
2017-04-07 13:13                 ` Andrea Arcangeli
2017-04-10 10:15           ` [PATCH 0/5] Re: [BUG][REGRESSION] i915 gpu hangs under load Martin Kepplinger
2017-04-10 10:15             ` [PATCH 0/5] Re: [Intel-gfx] " Martin Kepplinger

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=20170407131358.GB5035@redhat.com \
    --to=aarcange@redhat.com \
    --cc=airlied@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=regressions@leemhuis.info \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.