On Thu, 15 Jan 2015 18:57:20 +0300, Meyer Lansky said: if (hardirq_count()) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â per_cpu(cpu_hardirq_time, cpu) +Þlta; else if (in_serving_softirq() && !(curr->flags & PF_KSOFTIRQD)) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â per_cpu(cpu_softirq_time, cpu) +Þlta; > question: tell me what 's going on here ? If we're currently in a hardirq, we count the current time delta as hardirq time. If we're in a softirq, we count it as softirq time. To minimize stuff like cache thrashing and locking issues, each CPU has its own set of counters, and then any code that needs to compute the total will loop across all CPUs later and total them up (as that's *much* less common than incrementing the counters - often, we can even just export all the values to userspace, and do the addition there without any locking issues- see /proc/stat for an example) The numbers are later used (for example) by 'top' to show hard/soft interrupt time, and for other uses. top - 12:33:50 up 49 min, 1 user, load average: 0.25, 0.44, 0.49 Tasks: 206 total, 1 running, 205 sleeping, 0 stopped, 0 zombie %Cpu(s): 4.0 us, 3.8 sy, 0.0 ni, 91.2 id, 0.0 wa, 0.7 hi, 0.3 si, 0.0 st See the hi and si times (hard/soft irq)? That's what the above code is saving statistics for.
Attachment:
pgp5FrRH0GrIF.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies