All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 1/5] ALSA: seq: Use kvmalloc() for cell pools
Date: Tue,  9 Apr 2019 19:00:16 +0200	[thread overview]
Message-ID: <20190409170020.20685-2-tiwai@suse.de> (raw)
In-Reply-To: <20190409170020.20685-1-tiwai@suse.de>

Use kvmalloc() for allocating cell pools since the pool size can be
relatively small that may be covered better by slab.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/seq/seq_memory.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 5b0388202bac..6ea4d8a5a71e 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -24,7 +24,7 @@
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/sched/signal.h>
-#include <linux/vmalloc.h>
+#include <linux/mm.h>
 #include <sound/core.h>
 
 #include <sound/seq_kernel.h>
@@ -389,8 +389,8 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
 	if (snd_BUG_ON(!pool))
 		return -EINVAL;
 
-	cellptr = vmalloc(array_size(sizeof(struct snd_seq_event_cell),
-				     pool->size));
+	cellptr = kvmalloc_array(sizeof(struct snd_seq_event_cell), pool->size,
+				 GFP_KERNEL);
 	if (!cellptr)
 		return -ENOMEM;
 
@@ -398,7 +398,7 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
 	spin_lock_irqsave(&pool->lock, flags);
 	if (pool->ptr) {
 		spin_unlock_irqrestore(&pool->lock, flags);
-		vfree(cellptr);
+		kvfree(cellptr);
 		return 0;
 	}
 
@@ -456,7 +456,7 @@ int snd_seq_pool_done(struct snd_seq_pool *pool)
 	pool->total_elements = 0;
 	spin_unlock_irqrestore(&pool->lock, flags);
 
-	vfree(ptr);
+	kvfree(ptr);
 
 	spin_lock_irqsave(&pool->lock, flags);
 	pool->closing = 0;
-- 
2.16.4

  reply	other threads:[~2019-04-09 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 17:00 [PATCH 0/5] ALSA: seq: More cleanups and fixes Takashi Iwai
2019-04-09 17:00 ` Takashi Iwai [this message]
2019-04-09 17:00 ` [PATCH 2/5] ALSA: seq: Align temporary re-locking with irqsave version Takashi Iwai
2019-04-09 17:00 ` [PATCH 3/5] ALSA: seq: Remove superfluous irqsave flags Takashi Iwai
2019-04-09 17:00 ` [PATCH 4/5] ALSA: seq: Protect in-kernel ioctl calls with mutex Takashi Iwai
2019-04-09 17:00 ` [PATCH 5/5] ALSA: seq: Fix race of get-subscription call vs port-delete ioctls Takashi Iwai

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=20190409170020.20685-2-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /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.