Find the answer to your Linux question:
Results 1 to 5 of 5
Hi I've build a netfilter driver which receives a lot of data (800 Mbit/sec) and copies it to its internal buffers (using skb_copy_bits). I've tried checking its CPU usage (using ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    9

    netfilter KO performance


    Hi

    I've build a netfilter driver which receives a lot of data (800 Mbit/sec) and copies it to its internal buffers (using skb_copy_bits).
    I've tried checking its CPU usage (using /proc/stat or top) and found that the CPU usage is very low (less than 0.5%).
    However when I copy about the same amount of data in user space application I get much higher CPU usage.

    Does anyone has an idea why do I get such low CPU usage inside the kernel?
    I suspect that maybe some statistics are disabled, but I can't be sure.

    BR,
    Tal

  2. #2
    Just Joined!
    Join Date
    May 2013
    Posts
    19
    Do you copy also in the same way, I mean some alike program. That can make difference.
    Does your copy make directories or not, and the same for bothe your copy programs?
    It must be a reason in that direction.
    But not easy for me to tell, not knowing the details.

    b.t.w copying in memory is much faster the in filesystem...???

  3. #3
    Just Joined!
    Join Date
    Sep 2010
    Posts
    9
    Hi

    I don't understand you completely...
    The netfilter driver is copying buffers received from the network to its internal buffers and from there it is passed to the user.
    It has nothing to do to file system.

    Tal

  4. #4
    Just Joined!
    Join Date
    May 2013
    Posts
    19
    Well let me say it this way. Is your netfilter a kernel module?
    Then if you use exactly the same program to copy some data as normal user, it is slower? I understand of what you said it is all about copying in memory.

    Only thing I know userspace has some overhead because of priveledge checking, but I have no idea how much that would be.
    Kernel space programs are trusted an can run without any delay. But I don't think it would differ very much.
    Last edited by kuifje; 05-15-2013 at 11:33 AM.

  5. #5
    Just Joined!
    Join Date
    Sep 2010
    Posts
    9
    Hi

    Yes my netfilter is kernel module.
    I found out that there is a flag called CONFIG_IRQ_TIME_ACCOUNTING (I'm working with kernel version 3.6.
    This flag enables collection of time statistics inside IRQs and SIRQs.

    I turend it on and got the following results:
    5.61% CPU usage (using an application based on /proc/stat) even without my KO.
    After inserting my KO I got 5.91 CPU usage.

    I still can't understand why the CPU usage is that high when my KO isn't inserted.
    Maybe it is beacuse of the high interrupt rate.
    I'll try to check it out.

    Thanks for your help,
    Tal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •