Re: Time loss after calling netif_rx() in a kernel thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

On Wed, Jul 2, 2008 at 2:27 AM, Lukas Razik <razik@xxxxxxxxxxxxxxxxxxx> wrote:
> I use the following preemption (krenel v.2.6.22):
> # zcat /proc/config.gz | grep PREEMPT
> # CONFIG_PREEMPT_NONE is not set
> # CONFIG_PREEMPT_VOLUNTARY is not set
> CONFIG_PREEMPT=y
> CONFIG_PREEMPT_BKL=y

i see, and your HZ setting is? 250 I guess?

> Oh, I think you've understood my measuring method in a wrong way...
> I don't use jiffies to measure the time (I use do_gettimeofday()) but the
> highest time differences are about 4ms (which is one jiffie, if HZ=250),
> measured from the netif_rx() call in the kernel to the belonging return of
> recvfrom(socket_fd,...) in the userspace.

AFAIK, do_gettimeofday calls do_gettimeoffset...and seems like it
derived time offset based on jiffies.


> I've read this fact (about softirqd) but it seems that do_softirq() won't be
> executed... Not even if I do a yield() immediately after netif_rx() in my
> kernel thread. I thought the yield() would force the execution of ksoftirqd
> which has the same nice value (of +19) like my kernel thread.
> As I wrote you: The measured times are between some us and 4ms.
> In average I get 2ms.

hm, maybe ksoftirqd needs higher prio....

> Only if I call do_softirq() explicit after netif_rx() then I get times of
> !_about 10us_! in average instead of 2ms.
> So, at bottom line this is a solution for us but I wonder why the kernel
> doesn't call do_softirq() anyway sooner after the netif_rx() call.

To the best I know, do_softirq "throttles" itself....so if there are
many tasks queued there...it will be pushed to ksoftirqd. So, maybe
sometimes you got bad luck and ksoftirqd waits too long before
executed by scheduler.

Time to -rt kernel maybe?


> I dont't hold any locks and don't disable interrupts.
> There's only a while loop in my polling kernel thread...

OK, hope I help you some ways :)

regards,

Mulyadi

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux