[Intel-gfx] [PATCH v2 5/6] drm/i915: Reduce pointer indirection during cmd parser lookup

Jani Nikula jani.nikula at linux.intel.com
Mon Nov 23 00:09:16 PST 2015


On Fri, 20 Nov 2015, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> On Fri, Nov 20, 2015 at 03:34:22PM +0000, Chris Wilson wrote:
>> On Fri, Nov 20, 2015 at 05:27:43PM +0200, Ville Syrjälä wrote:
>> > On Fri, Nov 20, 2015 at 10:56:00AM +0000, Chris Wilson wrote:
>> > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
>> > > ---
>> > >  drivers/gpu/drm/i915/i915_cmd_parser.c | 51 ++++++++--------------------------
>> > >  drivers/gpu/drm/i915/i915_drv.h        |  4 ++-
>> > >  2 files changed, 14 insertions(+), 41 deletions(-)
>> > > 
>> > > diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c
>> > > index cfd07bfe6e75..ea9df2bb87de 100644
>> > > --- a/drivers/gpu/drm/i915/i915_cmd_parser.c
>> > > +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c
>> > > @@ -113,7 +113,7 @@
>> > >  
>> > >  /*            Command                          Mask   Fixed Len   Action
>> > >  	      ---------------------------------------------------------- */
>> > > -static const struct drm_i915_cmd_descriptor common_cmds[] = {
>> > > +static struct drm_i915_cmd_descriptor common_cmds[] = {
>> > 
>> > I'm a little sad to see the const gone. All this gets moved out of
>> > rodata.
>> 
>> I'm open to having this refused. Pretty much both of 4 & 5 can be
>> ignored after reducing the number of hash collisions in 6. Though not
>> having to duplicate the memory for the hash tables is nice.
>
> I don't have a strong opinion either way. On one hand rodata is nice,
> on the other hand simplicity from avoiding the kmalloc()s is nice.

One could allocate (by kmalloc or statically) an array of struct
cmd_node instead of each of them individually, however IIUC that was not
the main optimization here but rather the reduction of the pointer
chasing.

BR,
Jani.




-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list