simple memory malloc and free in ip_output.c

Anand Moon moon.linux at yahoo.com
Fri Dec 27 02:02:15 EST 2013


Hi, 

ip_queue_xmit will get called for every packet send, so frequent allocation and free of memory can be a problem for slab allocator.
If you need only 48 bytes of memory in a function you can chose to use array.

-Anand Moon

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.14 (GNU/Linux)
jA0EAwMCYq3dHqTzwcVgyRxC1j+oLxS8Yw92EIeKln+x3eAWzd7mM/pUluRo
=0RYk
-----END PGP MESSAGE-----




On Friday, December 27, 2013 11:11 AM, Guibin(Bill) Tian <gbtian at gmail.com> wrote:
  
It does work in your way, thanks Carson 

On Thursday, December 26, 2013, Guibin(Bill) Tian  wrote:

I tried it, still the same thing. 
>Also, there is another side effect that if I call the two lines of code above, the internet connection seems to break except to localhost. 
>
>
>
>On Thu, Dec 26, 2013 at 10:24 PM, bill4carson <bill4carson at gmail.com> wrote:
>
>
>>
>>On 2013年12月27日 11:16, Guibin(Bill) Tian 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);
>>>
                         ^^^^^^^^
>>                        GFP_ATOMIC ?
>>-- 
>>八百里秦川尘土飞扬,三千万老陕齐吼秦腔。
>>
>>--bill
>>
> 

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131226/e27a6158/attachment-0001.html 


More information about the Kernelnewbies mailing list