From: "Christian König" <deathsimple@vodafone.de>
To: "Michel Dänzer" <michel@daenzer.net>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/radeon: Use drm_malloc_ab instead of kmalloc_array
Date: Mon, 20 Oct 2014 14:47:18 +0200 [thread overview]
Message-ID: <54450456.8090208@vodafone.de> (raw)
In-Reply-To: <1413798054-24548-1-git-send-email-michel@daenzer.net>
Am 20.10.2014 um 11:40 schrieb Michel Dänzer:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> Should avoid kmalloc failures due to large number of array entries.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81991
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/radeon/radeon_cs.c | 2 +-
> drivers/gpu/drm/radeon/radeon_ring.c | 4 ++--
> drivers/gpu/drm/radeon/radeon_vm.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index 1c89344..a3e7aed 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> @@ -450,7 +450,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
> kfree(parser->track);
> kfree(parser->relocs);
> kfree(parser->relocs_ptr);
> - kfree(parser->vm_bos);
> + drm_free_large(parser->vm_bos);
> for (i = 0; i < parser->nchunks; i++)
> drm_free_large(parser->chunks[i].kdata);
> kfree(parser->chunks);
> diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
> index 596e591..51dcf40 100644
> --- a/drivers/gpu/drm/radeon/radeon_ring.c
> +++ b/drivers/gpu/drm/radeon/radeon_ring.c
> @@ -314,7 +314,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring
> }
>
> /* and then save the content of the ring */
> - *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
> + *data = drm_malloc_ab(size, sizeof(uint32_t));
> if (!*data) {
> mutex_unlock(&rdev->ring_lock);
> return 0;
> @@ -356,7 +356,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,
> }
>
> radeon_ring_unlock_commit(rdev, ring, false);
> - kfree(data);
> + drm_free_large(data);
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
> index 4532cc7..dfde266 100644
> --- a/drivers/gpu/drm/radeon/radeon_vm.c
> +++ b/drivers/gpu/drm/radeon/radeon_vm.c
> @@ -132,8 +132,8 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev,
> struct radeon_cs_reloc *list;
> unsigned i, idx;
>
> - list = kmalloc_array(vm->max_pde_used + 2,
> - sizeof(struct radeon_cs_reloc), GFP_KERNEL);
> + list = drm_malloc_ab(vm->max_pde_used + 2,
> + sizeof(struct radeon_cs_reloc));
> if (!list)
> return NULL;
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-10-20 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 9:40 [PATCH] drm/radeon: Use drm_malloc_ab instead of kmalloc_array Michel Dänzer
2014-10-20 9:43 ` Dave Airlie
2014-10-20 12:47 ` Christian König [this message]
2014-10-20 17:28 ` Alex Deucher
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=54450456.8090208@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=michel@daenzer.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.