From: Peter Zijlstra <peterz@xxxxxxxxxxxxx> So that all open_softirq() users can employ the same break conditions and work off the same time-base in case of multiple pending vectors. Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Signed-off-by: Liu Jian <liujian56@xxxxxxxxxx> --- include/linux/interrupt.h | 5 +++++ kernel/softirq.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index a92bce40b04b..94d1047fe0c3 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -584,8 +584,13 @@ extern const char * const softirq_to_name[NR_SOFTIRQS]; struct softirq_action { void (*action)(struct softirq_action *); + u64 start; + u64 timo; }; +extern struct softirq_action softirq_action_now(void); +extern bool softirq_needs_break(struct softirq_action *action); + asmlinkage void do_softirq(void); asmlinkage void __do_softirq(void); diff --git a/kernel/softirq.c b/kernel/softirq.c index baa08ae1604f..dc4299e40dad 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -533,6 +533,20 @@ static inline bool __softirq_needs_break(u64 start, u64 timo) return false; } +bool softirq_needs_break(struct softirq_action *h) +{ + return __softirq_needs_break(h->start, h->timo); +} + +struct softirq_action softirq_action_now(void) +{ + struct softirq_action h = { + .start = sched_clock(), + .timo = MAX_SOFTIRQ_TIME, + }; + return h; +} + asmlinkage __visible void __softirq_entry __do_softirq(void) { unsigned int max_restart = MAX_SOFTIRQ_RESTART; @@ -572,6 +586,8 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) __clear_bit(vec_nr, &pending); h = softirq_vec + vec_nr; + h->start = start; + h->timo = timo; prev_count = preempt_count(); -- 2.34.1