Is do_timer () supposed to be called by only one kernel in SMP systems?

I understand that do_timer is responsible for updating the jiffies counter. Therefore, my question is, can it be executed on different cores or always on the same core on which the timer mark occurred?

+2
source share
1 answer

Let me answer my question after searching and reading the code.

do_timer()supposed to be called on the processor with the id stored in tick_do_timer_cpu.

kernel/time/tick-common.c

/*
* tick_do_timer_cpu - , NR
*, do_timer(), .. .
* :
*
* 1) , * . CPU, * .
*
* 2) NOHZ, * TICK_DO_TIMER_NONE, CPU. , , * . * cpu hotplug.
*/

tick_do_timer_cpu tick_periodic() tick_sched_do_timer(). CPU , do_timer(), .

static void tick_periodic(int cpu)
 {
      if (tick_do_timer_cpu == cpu) {
              write_seqlock(&jiffies_lock);

              /* Keep track of the next tick event */
              tick_next_period = ktime_add(tick_next_period, tick_period);

              do_timer(1);
              write_sequnlock(&jiffies_lock);
              update_wall_time();
      }

      update_process_times(user_mode(get_irq_regs()));
      profile_tick(CPU_PROFILING);
  }`

, jiffies SMP-.

+2

All Articles