* [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation
@ 2015-02-05 5:52 Cho KyongHo
2015-04-08 16:01 ` Hans Verkuil
0 siblings, 1 reply; 3+ messages in thread
From: Cho KyongHo @ 2015-02-05 5:52 UTC (permalink / raw)
To: linux-media, laurent.pinchart, linux-kernel
Cc: mchehab, hans.verkuil, laurent.pinchart
The slab for vm_area_struct which is vm_area_cachep is already prepared
for the general use. Instead of kmalloc() for the vma copy for userptr,
allocation from vm_area_cachep is more beneficial.
CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
CC: Hans Verkuil <hans.verkuil@cisco.com>
CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
---
drivers/media/v4l2-core/videobuf2-memops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/v4l2-core/videobuf2-memops.c b/drivers/media/v4l2-core/videobuf2-memops.c
index 81c1ad8..dd06efa 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -37,7 +37,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
{
struct vm_area_struct *vma_copy;
- vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
+ vma_copy = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
if (vma_copy == NULL)
return NULL;
@@ -75,7 +75,7 @@ void vb2_put_vma(struct vm_area_struct *vma)
if (vma->vm_file)
fput(vma->vm_file);
- kfree(vma);
+ kmem_cache_free(vm_area_cachep, vma);
}
EXPORT_SYMBOL_GPL(vb2_put_vma);
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation
2015-02-05 5:52 [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation Cho KyongHo
@ 2015-04-08 16:01 ` Hans Verkuil
2015-04-09 0:38 ` Cho KyongHo
0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2015-04-08 16:01 UTC (permalink / raw)
To: Cho KyongHo, linux-media, laurent.pinchart, linux-kernel, mchehab
Cc: hans.verkuil
Mauro,
Please revert this patch: vm_area_cachep is not exported, so you cannot use this
in a module.
Cho KyongHo, if you believe that vm_area_cachep should be exported so it can be
used here, then please make a patch for that.
For the time being though, this patch should be reverted.
This patch slipped through the cracks and I clearly never reviewed it, and I only
noticed the problem after I compiled the media_tree git repo after this patch
was merged.
Regards,
Hans
On 02/05/2015 06:52 AM, Cho KyongHo wrote:
> The slab for vm_area_struct which is vm_area_cachep is already prepared
> for the general use. Instead of kmalloc() for the vma copy for userptr,
> allocation from vm_area_cachep is more beneficial.
>
> CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> CC: Hans Verkuil <hans.verkuil@cisco.com>
> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
> ---
> drivers/media/v4l2-core/videobuf2-memops.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-memops.c b/drivers/media/v4l2-core/videobuf2-memops.c
> index 81c1ad8..dd06efa 100644
> --- a/drivers/media/v4l2-core/videobuf2-memops.c
> +++ b/drivers/media/v4l2-core/videobuf2-memops.c
> @@ -37,7 +37,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
> {
> struct vm_area_struct *vma_copy;
>
> - vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
> + vma_copy = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
> if (vma_copy == NULL)
> return NULL;
>
> @@ -75,7 +75,7 @@ void vb2_put_vma(struct vm_area_struct *vma)
> if (vma->vm_file)
> fput(vma->vm_file);
>
> - kfree(vma);
> + kmem_cache_free(vm_area_cachep, vma);
> }
> EXPORT_SYMBOL_GPL(vb2_put_vma);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation
2015-04-08 16:01 ` Hans Verkuil
@ 2015-04-09 0:38 ` Cho KyongHo
0 siblings, 0 replies; 3+ messages in thread
From: Cho KyongHo @ 2015-04-09 0:38 UTC (permalink / raw)
To: 'Hans Verkuil',
linux-media, laurent.pinchart, linux-kernel, mchehab
Cc: hans.verkuil
Hans,
I didn't notice that vb2_put_vma is exported because I don't build modules.
I am sorry about bothering you.
Mauro,
I think it is better to drop my patch out from your tree
because I don't think it is not worth to export vm_area_cache_p to use it
in vb2_put_vma.
Regards,
KyongHo
-----Original Message-----
From: Hans Verkuil [mailto:hverkuil@xs4all.nl]
Sent: Thursday, April 09, 2015 1:01 AM
Mauro,
Please revert this patch: vm_area_cachep is not exported, so you cannot use
this in a module.
Cho KyongHo, if you believe that vm_area_cachep should be exported so it can
be used here, then please make a patch for that.
For the time being though, this patch should be reverted.
This patch slipped through the cracks and I clearly never reviewed it, and I
only noticed the problem after I compiled the media_tree git repo after this
patch was merged.
Regards,
Hans
On 02/05/2015 06:52 AM, Cho KyongHo wrote:
> The slab for vm_area_struct which is vm_area_cachep is already
> prepared for the general use. Instead of kmalloc() for the vma copy
> for userptr, allocation from vm_area_cachep is more beneficial.
>
> CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> CC: Hans Verkuil <hans.verkuil@cisco.com>
> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
> ---
> drivers/media/v4l2-core/videobuf2-memops.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-memops.c
> b/drivers/media/v4l2-core/videobuf2-memops.c
> index 81c1ad8..dd06efa 100644
> --- a/drivers/media/v4l2-core/videobuf2-memops.c
> +++ b/drivers/media/v4l2-core/videobuf2-memops.c
> @@ -37,7 +37,7 @@ struct vm_area_struct *vb2_get_vma(struct
> vm_area_struct *vma) {
> struct vm_area_struct *vma_copy;
>
> - vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
> + vma_copy = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
> if (vma_copy == NULL)
> return NULL;
>
> @@ -75,7 +75,7 @@ void vb2_put_vma(struct vm_area_struct *vma)
> if (vma->vm_file)
> fput(vma->vm_file);
>
> - kfree(vma);
> + kmem_cache_free(vm_area_cachep, vma);
> }
> EXPORT_SYMBOL_GPL(vb2_put_vma);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-09 0:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 5:52 [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation Cho KyongHo
2015-04-08 16:01 ` Hans Verkuil
2015-04-09 0:38 ` Cho KyongHo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®