From: "Michał Winiarski" <michal.winiarski@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
intel-gfx@lists.freedesktop.org,
Mika Kuoppala <mika.kuoppala@linux.intel.com>,
Michel Thierry <michel.thierry@intel.com>
Subject: Re: [PATCH v2] drm/i915/gtt: Avoid calling kcalloc in a loop when allocating temp bitmaps
Date: Tue, 1 Sep 2015 11:03:54 +0200 [thread overview]
Message-ID: <20150901090354.GA28590@mwiniars-desk1.igk.intel.com> (raw)
In-Reply-To: <20150831184234.GX17184@nuc-i3427.alporthouse.com>
On Mon, Aug 31, 2015 at 07:42:34PM +0100, Chris Wilson wrote:
> On Mon, Aug 31, 2015 at 06:59:40PM +0200, Michał Winiarski wrote:
> > On each call to gen8_alloc_va_range_3lvl we're allocating temporary
> > bitmaps needed for error handling. Unfortunately, when we increase
> > address space size (48b ppgtt) we do additional (512 - 4) calls to
> > kcalloc, increasing latency between exec and actual start of execution
> > on the GPU. Let's just do a single kcalloc and setup proper offsets in
> > an array, we can also drop the size from free_gen8_temp_bitmaps since
> > it's no longer needed.
> >
> > v2: Use GFP_TEMPORARY to make the allocations reclaimable.
> >
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > Cc: Michel Thierry <michel.thierry@intel.com>
> > Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
>
> Is there any reason why it remains a 2D array though? Looks like it can
> be reduced to a single block. And why do we allocate a bitmap for the
> whole address space rather than just the range being allocated?
No particular reason, let's try that.
It's not the whole address space... Quite possibly just 1/512 of the whole
address space, as the PUD is handled in gen8_alloc_va_range_4lvl. I guess it was
done to simplify... something, although I can't tell what at this point.
> While you may just answer the questions posed, this looks clumsy:
Yup - missed that, I was using temp variable before sending the patch.
-Michał
>
> > + *pts = kcalloc(pdpes * BITS_TO_LONGS(I915_PDES),
> > + sizeof(unsigned long), GFP_TEMPORARY);
> > + if (!*pts)
> > + goto err_out;
> > +
> > + for (i = 0; i < pdpes; i++)
> > + pts[i] = *pts + i * BITS_TO_LONGS(I915_PDES);
>
> i..e
>
> for (i = 1; i < pdpes; i++)
> pts[i] = pts[0] + i* BITS_TO_LONGS(I915_PDES);
>
> raises fewer questions.
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-09-01 9:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 16:27 [PATCH] drm/i915/gtt: Avoid calling kcalloc in a loop when allocating temp bitmaps Michał Winiarski
2015-08-31 16:40 ` Chris Wilson
2015-08-31 16:59 ` [PATCH v2] " Michał Winiarski
2015-08-31 18:42 ` Chris Wilson
2015-09-01 9:03 ` Michał Winiarski [this message]
2015-09-01 9:06 ` [PATCH v3] " Michał Winiarski
2015-09-02 13:40 ` Michel Thierry
2015-09-02 13:46 ` Chris Wilson
2015-09-02 15:13 ` Daniel Vetter
2015-09-02 15:26 ` Daniel Vetter
2015-09-02 15:46 ` [PATCH v4] " Michał Winiarski
2015-09-02 16:05 ` Chris Wilson
2015-09-03 17:22 ` [PATCH v5] " Michał Winiarski
2015-09-03 20:48 ` Chris Wilson
2015-09-04 7:53 ` 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=20150901090354.GA28590@mwiniars-desk1.igk.intel.com \
--to=michal.winiarski@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=michel.thierry@intel.com \
--cc=mika.kuoppala@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