LKML Archive on
help / color / mirror / Atom feed
* synchronise_rcu() takes 18ms on an idle system
@ 2020-03-11 14:33 David Laight
  0 siblings, 0 replies; only message in thread
From: David Laight @ 2020-03-11 14:33 UTC (permalink / raw)
  To: linux-kernel

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.


Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-11 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 14:33 synchronise_rcu() takes 18ms on an idle system David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).