2023-05-08 04:00:59

by liujian (CE)

[permalink] [raw]
Subject: Re: [PATCH 9/9] softirq, timer: Use softirq_needs_break()



On 2023/5/5 21:55, Hillf Danton wrote:
> On 5 May 2023 19:33:15 +0800 Liu Jian <[email protected]>
>> In the while loop of __run_timers(), because there are too many timers or
>> improper timer handler functions, if the processing time of the expired
>> timers is always greater than the time wheel's next_expiry, the function
>> will loop infinitely.
>>
>> To prevent this, use the timeout/break logic provided by SoftIRQs. If the
>> running time exceeds the limit, break the loop and an additional
>> TIMER_SOFTIRQ is triggered.
>
> This can not be a correct fix without getting every timer hog that runs
> longer than MAX_SOFTIRQ_TIME identified first and fixed.
> Do you mean that the timer that takes too long to execute needs to be
fixed first? Let's ignore this problem here. The modification is only
used to ensure that the loop exits when the loop execution time in
__run_timers() exceeds MAX_SOFTIRQ_TIME.

> The same applies to any softirq in general.
>