Messages in this thread | | | From | David Laight <> | Subject | synchronise_rcu() takes 18ms on an idle system | Date | Wed, 11 Mar 2020 14:33:51 +0000 |
| |
I'm looking into some scheduling delays in application that does audio processing.
The code calls sys_perf_event_open() (to get a cycle counter). After static_key_enable() has done some text_poke()s the code calls synchronise_rcu(). This is all not unreasonable.
__wait_rcu_gp() then calls wait_for_completion(). Which sleeps in schedule_timeout().
At this point I'd expect the 'rcu' to complete pretty quickly.
However my process doesn't get scheduled again for 18ms. The actual wakeup seems to be from smp_apic_timer_interrupt(). Probably because rcu_core_si() called wakeup_after_rcu() an then complete().
I think I understand 'rcu', I thought any code relying on it had to disable pre-emption - so that a process switch on every cpu was more then enough to release the waiter.
In this case my 4 cpu are largely idle.
Waiting 18ms seems odd, I'm pretty sure I've seen softint callbacks running for well over 1ms it isn't long enough for a slow system - but is too long for a fast one.
This is a 5.4-rc7 kernel with CONFIG_HZ=250.
Now I can mitigate this particular case by calling sys_perf_event_open() much earlier. But any other calls are problematic.
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |