Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Actually I am developing a module which is transferring the skb after filling it self. But the issue I am facing is, speed is too slow. only 1K pkt per sec. I think that is taking time for allocating memory to skb and freeing it.
I found on googling that we can make it efficient if we use skb pool in our driver module itself. I am kernel newbie, could any one plz tell me, how to implement it or it is not a good idea.
There's absolutely nothing that a CPU could possibly do, to cause a network adapter to only manage 1 kb/sec!
Memory allocation and deallocation (pooling ...) takes microseconds if not nanoseconds to do. Start by measuring the traffic that's taking place between the two machines, perhaps using a hardware monitoring device. The most likely culprit is always the application program that you're using for test purposes. It might not be behaving properly.
But as you say pooling takes microseconds. Speed is 1000 packet per second. In terms of Bytes it is more. M using Jradius Client for testing purpose.
Actually my scenario is :
I have a network driver, it receives pkt from network through hook then put info into KFIFO. another module, in which I have thread functionality for every online cpu. this module takes pkt info from KFIFO and again allocate skb, fill info into that skb with some extra header(RADIUS header) and again send back, then free the skb through kfree_skb(skb). It happens every time when it receives pkt from KFIFO.
This allocation and deallocation of skb every time takes time I think. So You please tell me that if we take a pool, which we will allocate at start of module itself. Then whenever we need any new skb, we will take it from that pool. I think it will take less time.
I don't know weather it is right or wrong, even don't know how to implement it. You please explain me. Should I do it or not. If yes then How??
M really thank full to you. My English is not that much good. Beg me pardon.
As we do in kernel, like "for_each_online_cpu()" I have created a kernel thread. That thread is bounded to available cpu. Thread's function is like, It will pick one packet from KFIFO. that packet is having information about coming IP,mac, etc. It will add these info to new allocated skb and send it using "dev_xmit()".
The allocation of skb is taking time in that thread. That's why I thought, I can use pre-allocated pool of skb. So that I won't be needed to allocate and de-allocate skb every time.
I have implemented it. But the thing is its getting more time, then previous.
As of now my statistics is :-
When allocate an skb - time taken > 400 mostly always greater then 1100.
de-allocation - time > 50-60
In terms of pool :-
dequeue the skb from pool - time taken > 300-400
again enqueue back to pool - time > 450
In between we have to re-initialize the skb that takes - time 300-700
Time is in terms of cpu ticks.
Thats all.
It may be possible that I am not implementing pool in a proper manner.
So, Please tell explain me, whatever I am doing is right or wrong.
Tell me the mechanism of skb pool implementation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.