mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cho KyongHo <pullip.cho@samsung.com>
To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
	linux-kernel@vger.kernel.org
Cc: mchehab@osg.samsung.com, hans.verkuil@cisco.com,
	laurent.pinchart@ideasonboard.com
Subject: [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation
Date: Thu, 05 Feb 2015 14:52:42 +0900	[thread overview]
Message-ID: <20150205145242.ebb07029fa8664144d687697@samsung.com> (raw)

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


             reply	other threads:[~2015-02-05  5:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05  5:52 Cho KyongHo [this message]
2015-04-08 16:01 ` Hans Verkuil
2015-04-09  0:38   ` Cho KyongHo

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=20150205145242.ebb07029fa8664144d687697@samsung.com \
    --to=pullip.cho@samsung.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /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 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®