@@ -740,29 +740,31 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
740740 s64 __maybe_unused steal = 0 , irq_delta = 0 ;
741741
742742#ifdef CONFIG_IRQ_TIME_ACCOUNTING
743- irq_delta = irq_time_read (cpu_of (rq )) - rq -> prev_irq_time ;
743+ if (irqtime_enabled ()) {
744+ irq_delta = irq_time_read (cpu_of (rq )) - rq -> prev_irq_time ;
744745
745- /*
746- * Since irq_time is only updated on {soft,}irq_exit, we might run into
747- * this case when a previous update_rq_clock() happened inside a
748- * {soft,}IRQ region.
749- *
750- * When this happens, we stop ->clock_task and only update the
751- * prev_irq_time stamp to account for the part that fit, so that a next
752- * update will consume the rest. This ensures ->clock_task is
753- * monotonic.
754- *
755- * It does however cause some slight miss-attribution of {soft,}IRQ
756- * time, a more accurate solution would be to update the irq_time using
757- * the current rq->clock timestamp, except that would require using
758- * atomic ops.
759- */
760- if (irq_delta > delta )
761- irq_delta = delta ;
746+ /*
747+ * Since irq_time is only updated on {soft,}irq_exit, we might run into
748+ * this case when a previous update_rq_clock() happened inside a
749+ * {soft,}IRQ region.
750+ *
751+ * When this happens, we stop ->clock_task and only update the
752+ * prev_irq_time stamp to account for the part that fit, so that a next
753+ * update will consume the rest. This ensures ->clock_task is
754+ * monotonic.
755+ *
756+ * It does however cause some slight miss-attribution of {soft,}IRQ
757+ * time, a more accurate solution would be to update the irq_time using
758+ * the current rq->clock timestamp, except that would require using
759+ * atomic ops.
760+ */
761+ if (irq_delta > delta )
762+ irq_delta = delta ;
762763
763- rq -> prev_irq_time += irq_delta ;
764- delta -= irq_delta ;
765- delayacct_irq (rq -> curr , irq_delta );
764+ rq -> prev_irq_time += irq_delta ;
765+ delta -= irq_delta ;
766+ delayacct_irq (rq -> curr , irq_delta );
767+ }
766768#endif
767769#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
768770 if (static_key_false ((& paravirt_steal_rq_enabled ))) {
0 commit comments