Hi, In the following cases, how does the CPU work done by the kernel on behalf of the application get accounted for? 1. When an application writes to a TCP/UDP socket, the networking stack does transmit side processing. 2. When an application receives data on a TCP/UDP socket, the networking stack does receive side processing.
From what I understand: In case (1), the kernel code executes in the context of the application, so the CPU cycles are accounted directly to process that called write() (or send/sendto). But in case (2), unless some processing is done, it is impossible to know which application is going to receive this packet. Whom do these cycles get charged to?
Thanks, -- Vimal
Hi .. :) On Wed, Sep 14, 2011 at 21:04, Vimal <j.vimal@gmail.com> wrote:
Hi,
In the following cases, how does the CPU work done by the kernel on behalf of the application get accounted for?
1. When an application writes to a TCP/UDP socket, the networking stack does transmit side processing. 2. When an application receives data on a TCP/UDP socket, the networking stack does receive side processing.
From what I understand: In case (1), the kernel code executes in the context of the application, so the CPU cycles are accounted directly to process that called write() (or send/sendto).
excellent thinking, however AFAIK sometimes (or most of the times now?) data sending is done in asynchronous style..... so the counting might be not so accurate since we don't really know how much the data that are transmitted...
But in case (2), unless some processing is done, it is impossible to know which application is going to receive this packet. Whom do these cycles get charged to?
excellent thinking..... I place my bet on ksoftirqd -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Hi Mulyadi :) On 14 September 2011 12:44, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
From what I understand: In case (1), the kernel code executes in the context of the application, so the CPU cycles are accounted directly to process that called write() (or send/sendto).
excellent thinking, however AFAIK sometimes (or most of the times now?) data sending is done in asynchronous style..... so the counting might be not so accurate since we don't really know how much the data that are transmitted...
Ah I completely forgot asynchronous case. Thanks for pointing it out!
But in case (2),
excellent thinking..... I place my bet on ksoftirqd
Thanks. I think it makes sense. Let me think of a way to actually confirm this. If you know of a way, do chip in :-) thanks, -- Vimal
Hi :) On Thu, Sep 15, 2011 at 20:19, Vimal <j.vimal@gmail.com> wrote:
Thanks. I think it makes sense. Let me think of a way to actually confirm this. If you know of a way, do chip in :-)
Resource Accounting is always a big problem to be done right..... AFAIK there was patches from Matt McKall that did try to improve it.... but I am not sure whether it touches the area you currently work on or not. Try google, I forgot the exact URL.... -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
participants (2)
-
Mulyadi Santosa -
Vimal