Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-devel] change kmalloc into vmalloc for large memory allocations
@ 2014-02-28  8:15 Wang, Yalin
  2014-02-28  8:54 ` Huang Shijie
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Wang, Yalin @ 2014-02-28  8:15 UTC (permalink / raw)
  To: 'linux-kernel@vger.kernel.org',
	'linux-arm-msm@vger.kernel.org',
	'linux-arm-kernel@lists.infradead.org',
	'linux-input@vger.kernel.org', 'balbi@ti.com',
	'gregkh@linuxfoundation.org', 'lrg@ti.com',
	'broonie@opensource.wolfsonmicro.com',
	'perex@perex.cz', 'tiwai@suse.de',
	'pablo@netfilter.org', 'kaber@trash.net',
	'davem@davemloft.net', 'rostedt@goodmis.org',
	'fweisbec@gmail.com', 'mingo@redhat.com',
	'dmitry.torokhov@gmail.com',
	'rydberg@euromail.se',
	'linux-usb@vger.kernel.org'

Hi 


I find there is some drivers use kmalloc to allocate large 
Memorys during module_init,  some can be changed to use vmalloc
To save some low mem, I add log in kernel to track ,
And list them here:

https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/drivers/usb/gadget/f_mass_storage.c?h=master#n2724

https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/sound/soc/soc-core.c?h=master#n3772

https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_ftp.c?h=master#n603
https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_h323_main.c?h=master#n1849
https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_irc.c?h=master#n247
https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/net/netfilter/nf_conntrack_sane.c?h=master#n195

https://git.kernel.org/cgit/linux/kernel/git/will/linux.git/tree/drivers/input/evdev.c?h=master#n403


they allocate large memory from 10k~64K , 
this will use lots of low mem, instead if we use 
vmalloc for these drivers , it will be good for some devices
like smart phone, we often encounter some errors like kmalloc failed 
because there is not enough low mem , especially when the device has physical 
memory less than 1GB .


could this module change the memory allocation into vmalloc ?

I was thinking that if we can introduce a helper function in kmalloc.h like this :

Kmalloc(size, flags)
{
	If (size > PAGE_SIZE && flags&CAN_USE_VMALLOC_FLAG)
		return vmalloc(size);
	Else
		return real_kmalloc(size);
}

Kfree(ptr)
{
	If (is_vmalloc_addr(ptr))
		Vfree(ptr);
	Else
		Kfree(ptr);
}


But we need add some flags to ensure always use kmalloc for
Some special use (dma etc..)

How do you think of it ?

Thanks



_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2014-03-04  7:30 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28  8:15 [alsa-devel] change kmalloc into vmalloc for large memory allocations Wang, Yalin
2014-02-28  8:54 ` Huang Shijie
2014-02-28  9:20   ` Wang, Yalin
2014-02-28 16:33     ` 'gregkh@linuxfoundation.org'
2014-03-03  2:51       ` Wang, Yalin
2014-03-03  3:08         ` 'gregkh@linuxfoundation.org'
2014-03-03  8:00           ` Wang, Yalin
2014-03-03 14:10             ` 'gregkh@linuxfoundation.org'
2014-03-04  7:30               ` [PATCH] netfilter:Change nf_conntrack modules to use vmalloc Wang, Yalin
2014-02-28 14:11 ` change kmalloc into vmalloc for large memory allocations Steven Rostedt
2014-02-28 14:19 ` Takashi Iwai
2014-03-03  1:55   ` Wang, Yalin
2014-03-03  9:19     ` Takashi Iwai
2014-03-03  9:23       ` Takashi Iwai
2014-03-03 11:13         ` Wang, Yalin
2014-03-03 11:34           ` [alsa-devel] " Lars-Peter Clausen
2014-03-03 11:36             ` Wang, Yalin
2014-03-03 11:45               ` Lars-Peter Clausen
2014-03-03 13:29                 ` [alsa-devel] " Wang, Yalin
2014-03-03 14:22                   ` Lars-Peter Clausen
2014-03-03 14:29                     ` Wang, Yalin
2014-03-03 14:43                       ` Takashi Iwai
2014-03-03 15:33                         ` Wang, Yalin
2014-03-04  3:46                           ` [alsa-devel] " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox