Thread (6 messages) 6 messages, 4 authors, 2014-01-02

simple memory malloc and free in ip_output.c

From: Mulyadi Santosa <hidden>
Date: 2014-01-02 05:12:49

On Fri, Dec 27, 2013 at 10:16 AM, Guibin(Bill) Tian [off-list ref] wrote:
Hi,
I am doing a very simple operation at the method of ip_queue_xmit in
ip_output.c.
The code is very simple.

char *p = kmalloc(48, GFP_KERNEL);
kfree(p);

This will be called every time this method is called.

But the result is that the whole system is not responsive at all. This is a
very simple, not sure what I am doing wrong. Can anybody help?
Other than what others have said, IMHO it is better to avoid such
rapid alloc/free, assuming your code fragment is running on every
packet reception/sending.

Instead, I suggest to allocate the memory before the ip_queue_xmit and
use-reuse it inside ip_queue_xmit.




-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help