Kernel timer context + proper usage

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

 



Hi,

I have a couple of general doubts on kernel timers and the context in
which they run. I gather that a kernel timer would run in the
bottom_half interrupt context (please correct me if wrong), and as
people have pointed out multiple times, one should never write code
which may sleep in the bottom_half context?

I have an application in which I am required to buffer packets meant
to a network card (which I can accomplish with the skb_queue* API).
When a particular timer fires, the buffered packets are to be sent to
the network card. I am intercepting the packets in the "bonding"
drivers send function, here I buffer the packet and set up a couple of
timers. So, my question here is that, will sending something of the
order of a 500-1000 packets to the network cards queue from within the
timeout function a safe operation? Guessing from my little knowledge
about the Linux kernel, aren't bottom half contexts meant for bulk
processing of kernel jobs, which makes it perfectly alright to deal
with such large amounts of code?

Also, even though until dev_queue_xmit the send procedure for a packet
is executed in the system call (user) context, the actual send may be
dealt by a bottom half? That is, once the packet has been added to the
network drivers send queue, it is later processed in a bottom_half
(most likely a tasklet)? If this is true, would the argument also
extend to the timer bottom halves?

I would be happy if you can point any mistakes in my general
understanding, would help me avoid unnecessary debugging/redesign
time.

Thanks and regards,
- CCK.

-- 
Chandrakanth Chereddi.
ECE-UIUC.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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