Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/7] drm/i915: Trim unused workaround list entries
Date: Mon, 3 Dec 2018 10:39:48 +0000	[thread overview]
Message-ID: <46b7bbee-1352-a409-620b-e947be29e629@linux.intel.com> (raw)
In-Reply-To: <154361508305.20153.9004851883610879680@skylake-alporthouse-com>


On 30/11/2018 21:58, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-11-30 17:44:12)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> The new workaround list allocator grows the list in chunks so will end up
>> with some unused space. Trim it when the initialization phase is done to
>> free up a tiny bit of slab.
>>
>> v2:
>>   * Simplify with kmemdup. (Chris Wilson)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_workarounds.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_workarounds.c b/drivers/gpu/drm/i915/intel_workarounds.c
>> index 3e6b388ea022..9d876d554e57 100644
>> --- a/drivers/gpu/drm/i915/intel_workarounds.c
>> +++ b/drivers/gpu/drm/i915/intel_workarounds.c
>> @@ -55,6 +55,19 @@ static void wa_init_start(struct i915_wa_list *wal, const char *name)
>>   
>>   static void wa_init_finish(struct i915_wa_list *wal)
>>   {
>> +       /* Trim unused entries. */
>> +       if (wal->count < wal->__size) {
>> +               struct i915_wa *list = kmemdup(wal->list,
>> +                                              wal->count * sizeof(*list),
>> +                                              GFP_KERNEL);
>> +
>> +               if (list) {
>> +                       kfree(wal->list);
>> +                       wal->list = list;
>> +                       wal->__size = wal->count;
> 
> Hmm. We could kill __size entirely if you reallocated on
> is_power_of_two(wal->count).

You mean allocate to next power of two is is_power_of_two(wal->count) ? 
In that case I could also allocate to next ALIGN(wal->count, CHUNK_SIZE) 
if IS_ALIGNED which looks more appropriate for this particular use case.

Can't decide whether it is worth it though. Why not..

Regards,

Tvrtko

> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-12-03 10:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-30 17:44 [PATCH v2 0/8] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-11-30 17:44 ` [PATCH 1/7] drm/i915: Record GT workarounds in a list Tvrtko Ursulin
2018-11-30 21:51   ` Chris Wilson
2018-11-30 17:44 ` [PATCH 2/7] drm/i915: Introduce per-engine workarounds Tvrtko Ursulin
2018-11-30 20:56   ` Chris Wilson
2018-11-30 21:53   ` Chris Wilson
2018-11-30 22:13   ` Rodrigo Vivi
2018-11-30 17:44 ` [PATCH 3/7] drm/i915: Verify GT workaround state after GPU init Tvrtko Ursulin
2018-11-30 21:55   ` Chris Wilson
2018-11-30 17:44 ` [PATCH 4/7] drm/i915/selftests: Add tests for GT and engine workaround verification Tvrtko Ursulin
2018-11-30 21:04   ` Chris Wilson
2018-11-30 22:01     ` Chris Wilson
2018-11-30 17:44 ` [PATCH 5/7] drm/i915: Move register white-listing to the common workaround framework Tvrtko Ursulin
2018-11-30 21:08   ` Chris Wilson
2018-11-30 22:03     ` Chris Wilson
2018-11-30 17:44 ` [PATCH 6/7] drm/i915: Fuse per-context workaround handling with the common framework Tvrtko Ursulin
2018-11-30 21:22   ` Chris Wilson
2018-12-03 10:34     ` Tvrtko Ursulin
2018-11-30 17:44 ` [PATCH 7/7] drm/i915: Trim unused workaround list entries Tvrtko Ursulin
2018-11-30 21:58   ` Chris Wilson
2018-12-03 10:39     ` Tvrtko Ursulin [this message]
2018-11-30 17:53 ` ✗ Fi.CI.CHECKPATCH: warning for Restore workarounds after engine reset and unify their handling (rev2) Patchwork
2018-11-30 17:56 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-30 18:24 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-01 13:36 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-12-03 11:46 [PATCH v3 0/7] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-12-03 11:46 ` [PATCH 7/7] drm/i915: Trim unused workaround list entries Tvrtko Ursulin
2018-12-03 12:03   ` Chris Wilson
2018-12-03 12:50 [PATCH v4 0/7] Restore workarounds after engine reset and unify their handling Tvrtko Ursulin
2018-12-03 12:50 ` [PATCH 7/7] drm/i915: Trim unused workaround list entries Tvrtko Ursulin
2018-12-03 12:52   ` Chris Wilson

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=46b7bbee-1352-a409-620b-e947be29e629@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    /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