Hello!  Excuse me for my english.
I study source code scheduler O(1)
code:

if (hardirq_count())
                per_cpu(cpu_hardirq_time, cpu) +=delta;
else if (in_serving_softirq() && !(curr->flags & PF_KSOFTIRQD))
                per_cpu(cpu_softirq_time, cpu) +=delta;

question: tell me what's going on here?

I have this code in paper form, so I can not give you a link to the code.
If there is a need to rewrite your page

please help!