diff mbox series

[1/9] drm/i915/gtt: No need to zero the table for page dirs

Message ID 20190611172731.19174-1-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/9] drm/i915/gtt: No need to zero the table for page dirs | expand

Commit Message

Mika Kuoppala June 11, 2019, 5:27 p.m. UTC
We set them to scratch right after allocation so prevent
useless zeroing before.

v2: atomic_t

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chris Wilson June 11, 2019, 7:37 p.m. UTC | #1
Quoting Mika Kuoppala (2019-06-11 18:27:23)
> We set them to scratch right after allocation so prevent
> useless zeroing before.
> 
> v2: atomic_t
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index e70675bfb51d..07f86d474fa2 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -687,7 +687,7 @@ static struct i915_page_directory *alloc_pd(struct i915_address_space *vm)
>  {
>         struct i915_page_directory *pd;
>  
> -       pd = kzalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL);
> +       pd = kmalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL);
>         if (unlikely(!pd))
>                 return ERR_PTR(-ENOMEM);
>  
> @@ -747,7 +747,7 @@ alloc_pdp(struct i915_address_space *vm)
>  
>         GEM_BUG_ON(!i915_vm_is_4lvl(vm));
>  
> -       pdp = kzalloc(sizeof(*pdp), GFP_KERNEL);
> +       pdp = kmalloc(sizeof(*pdp), GFP_KERNEL);

While you are here, this too can be I915_GFP_ALLOW_FAIL

>         if (!pdp)
>                 return ERR_PTR(-ENOMEM);

Because we immediately propagate the error and can gracefully handle
failures.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index e70675bfb51d..07f86d474fa2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -687,7 +687,7 @@  static struct i915_page_directory *alloc_pd(struct i915_address_space *vm)
 {
 	struct i915_page_directory *pd;
 
-	pd = kzalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL);
+	pd = kmalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL);
 	if (unlikely(!pd))
 		return ERR_PTR(-ENOMEM);
 
@@ -747,7 +747,7 @@  alloc_pdp(struct i915_address_space *vm)
 
 	GEM_BUG_ON(!i915_vm_is_4lvl(vm));
 
-	pdp = kzalloc(sizeof(*pdp), GFP_KERNEL);
+	pdp = kmalloc(sizeof(*pdp), GFP_KERNEL);
 	if (!pdp)
 		return ERR_PTR(-ENOMEM);