asoc: msm: use hashtable to check kcontrol
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 asoc: msm: use hashtable to check kcontrol
use hashtable instead of linear list to check kcontrol before adding them for improving early audio KPI.
With this changes we see 600ms improvement in start of audio
Change-Id I1a95d88ef41b48430b57307a0e6a8e82788b4372
Signed-off-by Raghu Bankapur <[email protected]>
--- include/sound/control.h | 2 + include/sound/core.h | 5 +- sound/core/control.c | 106 +++++++++++++++++++++++----------------- sound/core/init.c | 1 + 4 files changed, 68 insertions(+), 46 deletions(-)
include/sound/control.h +2 -0
@@ -70,6 +70,8 @@ struct snd_kcontrol_volatile {struct snd_kcontrol {struct list_head list;/* list of controls */ struct snd_ctl_elem_id id; +struct hlist_node hnode; +unsigned int knametoint;/* kctl name to uint, hash key value */ unsigned int count;/* count of same elements */ snd_kcontrol_info_t *info;snd_kcontrol_get_t *get;
include/sound/core.h +4 -1
@@ -14,6 +14,7 @@#include <linux/pm.h> /* pm_message_t */ #include <linux/stringify.h> #include <linux/printk.h> +#include <linux/hashtable.h> /* number of supported soundcards */ #ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -24,6 +25,8 @@#define CONFIG_SND_MAJOR 116/* standard configuration */ +#define SND_CTL_HASH_TABLE_BITS 14/* buckets numbers: 1 << 14 */ +/* forward declarations */ struct pci_dev ;struct module ;
@@ -103,7 +106,7 @@ struct snd_card {size_t user_ctl_alloc_size;// current memory allocation by user controls. struct list_head controls;/* all controls for this card */ struct list_head ctl_files;/* active control files */ - +DECLARE_HASHTABLE (ctl_htable,SND_CTL_HASH_TABLE_BITS );struct snd_info_entry *proc_root;/* root for soundcard specific files */ struct proc_dir_entry *proc_root_link;/* number link to real id */
sound/core/control.c +61 -45
136 lines not on this page · raw message
sound/core/init.c +1 -0
@@ -284,6 +284,7 @@ static int snd_card_init(struct snd_card *card, struct device *parent,INIT_LIST_HEAD (&card->ctl_files);spin_lock_init (&card->files_lock);INIT_LIST_HEAD (&card->files_list); +hash_init (card->ctl_htable);mutex_init (&card->memory_mutex);#ifdef CONFIG_PM init_waitqueue_head (&card->power_sleep);
Signature · 1 line
2.17.1