Message ID | 20191010145127.7487-1-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/5] drm/i915: Shrink eDRAM ways/sets arrays | expand |
On 2019-10-10 at 17:51:23 +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Make the ways/sets arrays static cosnt u8 to shrink things a bit. > > text data bss dec hex filename > - 23935 629 128 24692 6074 i915_drv.o > + 23818 629 128 24575 5fff i915_drv.o > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/i915_drv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index f02a34722217..0b8c13ae4857 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -1073,8 +1073,8 @@ intel_get_dram_info(struct drm_i915_private *dev_priv) > > static u32 gen9_edram_size_mb(struct drm_i915_private *dev_priv, u32 cap) > { > - const unsigned int ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > - const unsigned int sets[4] = { 1, 1, 2, 2 }; > + static const u8 ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > + static const u8 sets[4] = { 1, 1, 2, 2 }; Asking for my understanding. unsigned int -> u8 make sense to shrink the size. Could you please add reasoning for adding static? moving it into data segment hence reducing the stack? -Ram > > return EDRAM_NUM_BANKS(cap) * > ways[EDRAM_WAYS_IDX(cap)] * > -- > 2.21.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Thu, Oct 17, 2019 at 01:28:29PM +0530, Ramalingam C wrote: > On 2019-10-10 at 17:51:23 +0300, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Make the ways/sets arrays static cosnt u8 to shrink things a bit. > > > > text data bss dec hex filename > > - 23935 629 128 24692 6074 i915_drv.o > > + 23818 629 128 24575 5fff i915_drv.o > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/i915/i915_drv.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > > index f02a34722217..0b8c13ae4857 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.c > > +++ b/drivers/gpu/drm/i915/i915_drv.c > > @@ -1073,8 +1073,8 @@ intel_get_dram_info(struct drm_i915_private *dev_priv) > > > > static u32 gen9_edram_size_mb(struct drm_i915_private *dev_priv, u32 cap) > > { > > - const unsigned int ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > > - const unsigned int sets[4] = { 1, 1, 2, 2 }; > > + static const u8 ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > > + static const u8 sets[4] = { 1, 1, 2, 2 }; > Asking for my understanding. unsigned int -> u8 make sense to shrink the > size. Could you please add reasoning for adding static? moving it into > data segment hence reducing the stack? Possibly. My usual approach is to just make all such things static const unless there is a real reason not to. > > -Ram > > > > return EDRAM_NUM_BANKS(cap) * > > ways[EDRAM_WAYS_IDX(cap)] * > > -- > > 2.21.0 > > > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On 2019-10-17 at 15:54:46 +0300, Ville Syrjälä wrote: > On Thu, Oct 17, 2019 at 01:28:29PM +0530, Ramalingam C wrote: > > On 2019-10-10 at 17:51:23 +0300, Ville Syrjala wrote: > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > Make the ways/sets arrays static cosnt u8 to shrink things a bit. > > > > > > text data bss dec hex filename > > > - 23935 629 128 24692 6074 i915_drv.o > > > + 23818 629 128 24575 5fff i915_drv.o > > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Looks good to me. Reviewed-by: Ramalingam C <ramalingam.c@intel.com> > > > --- > > > drivers/gpu/drm/i915/i915_drv.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > > > index f02a34722217..0b8c13ae4857 100644 > > > --- a/drivers/gpu/drm/i915/i915_drv.c > > > +++ b/drivers/gpu/drm/i915/i915_drv.c > > > @@ -1073,8 +1073,8 @@ intel_get_dram_info(struct drm_i915_private *dev_priv) > > > > > > static u32 gen9_edram_size_mb(struct drm_i915_private *dev_priv, u32 cap) > > > { > > > - const unsigned int ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > > > - const unsigned int sets[4] = { 1, 1, 2, 2 }; > > > + static const u8 ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; > > > + static const u8 sets[4] = { 1, 1, 2, 2 }; > > Asking for my understanding. unsigned int -> u8 make sense to shrink the > > size. Could you please add reasoning for adding static? moving it into > > data segment hence reducing the stack? > > Possibly. My usual approach is to just make all such things > static const unless there is a real reason not to. Ok. Thanks. -Ram > > > > > -Ram > > > > > > return EDRAM_NUM_BANKS(cap) * > > > ways[EDRAM_WAYS_IDX(cap)] * > > > -- > > > 2.21.0 > > > > > > _______________________________________________ > > > Intel-gfx mailing list > > > Intel-gfx@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Ville Syrjälä > Intel
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index f02a34722217..0b8c13ae4857 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1073,8 +1073,8 @@ intel_get_dram_info(struct drm_i915_private *dev_priv) static u32 gen9_edram_size_mb(struct drm_i915_private *dev_priv, u32 cap) { - const unsigned int ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; - const unsigned int sets[4] = { 1, 1, 2, 2 }; + static const u8 ways[8] = { 4, 8, 12, 16, 16, 16, 16, 16 }; + static const u8 sets[4] = { 1, 1, 2, 2 }; return EDRAM_NUM_BANKS(cap) * ways[EDRAM_WAYS_IDX(cap)] *