Skip to content

Commit

Permalink
Merge tag 'sched-urgent-2025-03-14' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/tip

Pull scheduler fix from Ingo Molnar:
 "Fix a sleeping-while-atomic bug caused by a recent optimization
  utilizing static keys that didn't consider that the
  static_key_disable() call could be triggered in atomic context.

  Revert the optimization"

* tag 'sched-urgent-2025-03-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/clock: Don't define sched_clock_irqtime as static key
  • Loading branch information
Linus Torvalds committed Mar 14, 2025
2 parents 28c5099 + f3fa0e4 commit a22ea73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions kernel/sched/cputime.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#ifdef CONFIG_IRQ_TIME_ACCOUNTING

DEFINE_STATIC_KEY_FALSE(sched_clock_irqtime);

/*
* There are no locks covering percpu hardirq/softirq time.
* They are only modified in vtime_account, on corresponding CPU
Expand All @@ -24,14 +22,16 @@ DEFINE_STATIC_KEY_FALSE(sched_clock_irqtime);
*/
DEFINE_PER_CPU(struct irqtime, cpu_irqtime);

int sched_clock_irqtime;

void enable_sched_clock_irqtime(void)
{
static_branch_enable(&sched_clock_irqtime);
sched_clock_irqtime = 1;
}

void disable_sched_clock_irqtime(void)
{
static_branch_disable(&sched_clock_irqtime);
sched_clock_irqtime = 0;
}

static void irqtime_account_delta(struct irqtime *irqtime, u64 delta,
Expand Down
4 changes: 2 additions & 2 deletions kernel/sched/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -3259,11 +3259,11 @@ struct irqtime {
};

DECLARE_PER_CPU(struct irqtime, cpu_irqtime);
DECLARE_STATIC_KEY_FALSE(sched_clock_irqtime);
extern int sched_clock_irqtime;

static inline int irqtime_enabled(void)
{
return static_branch_likely(&sched_clock_irqtime);
return sched_clock_irqtime;
}

/*
Expand Down

0 comments on commit a22ea73

Please sign in to comment.