1oom_classic_sdl2 resource usage after suspend/resume is crazy
Ok, not sure this can be repro'd and I'm running a build with sanitizers, so that might be to blame as well. I've started a large game last night, suspended my laptop, came back the next evening and noticed that sound is super laggy (about 2s delayed vs. the button clicks).
top(1) as this to say:
% top -b|head -10
top - 15:17:25 up 4 days, 17:06, 9 users, load average: 0.61, 1.52, 1.83
Tasks: 412 total, 1 running, 410 sleeping, 0 stopped, 1 zombie
%Cpu(s): 12.9 us, 7.1 sy, 1.2 ni, 74.1 id, 0.0 wa, 0.0 hi, 4.7 si, 0.0 st
MiB Mem : 15953.3 total, 473.1 free, 12171.9 used, 3308.3 buff/cache
MiB Swap: 32520.0 total, 28235.7 free, 4284.3 used. 1467.8 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
347586 XXX 20 0 20.0t 546492 8892 S 29.4 3.3 178:16.97 1oom_classic_sd
2284 XXX 20 0 2158004 10812 7208 S 11.1 0.1 208:38.32 pulseaudio
The 20T of VSZ is probably due to sanitizers spraying things all over the heap. Of note is the 30% CPU usage while I'm looking at the galaxy screen doing nothing else. Pulseaudio freaking out is also very sus and could explain the audio lag.
strace shows it's polling like mad on fd 4.
ltrace'ing for 11s shows:
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
35.86 4.195766 528 7946 pthread_getspecific
20.76 2.429093 12651 192 SDL_SetRenderTarget
12.61 1.475491 15369 96 SDL_RenderPresent
12.21 1.428184 10738 133 SDL_Delay
10.02 1.171885 12207 96 SDL_UnlockTexture
2.10 0.246216 626 393 SDL_GetTicks
2.09 0.244901 1827 134 SDL_PumpEvents
1.56 0.182726 1903 96 SDL_UpperBlit
1.01 0.118331 616 192 SDL_RenderCopy
0.77 0.090133 672 134 SDL_PollEvent
0.54 0.063328 659 96 SDL_LockTexture
0.46 0.053575 558 96 SDL_RenderClear
------ ----------- ----------- --------- --------------------
100.00 11.699629 9604 total
doesn't look very audio-related?
Oh, I also had to un- and replug the docking station and USB audio device. Another thing that could've tripped stuff up.
So what else do we have?
gdb shows these threads:
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7fad72751840 (LWP 347586) "1oom_classic_sd" 0x00007fad73c5bd21 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0,
req=0x7fff6c654a10, rem=0x7fff6c654a00) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
2 Thread 0x7fad66f49700 (LWP 347588) "1oom_cl:disk$0" futex_wait_cancelable (private=0, expected=0, futex_word=0x614000002508)
at ../sysdeps/nptl/futex-internal.h:183
3 Thread 0x7fad66748700 (LWP 347589) "1oom_cl:disk$1" futex_wait_cancelable (private=0, expected=0, futex_word=0x614000002508)
at ../sysdeps/nptl/futex-internal.h:183
4 Thread 0x7fad65f47700 (LWP 347590) "1oom_cl:disk$2" futex_wait_cancelable (private=0, expected=0, futex_word=0x614000002508)
at ../sysdeps/nptl/futex-internal.h:183
5 Thread 0x7fad65730700 (LWP 347591) "1oom_cl:disk$3" futex_wait_cancelable (private=0, expected=0, futex_word=0x614000002508)
at ../sysdeps/nptl/futex-internal.h:183
6 Thread 0x7fad54e7f700 (LWP 347592) "PulseHotplug" 0x00007fad73c895b6 in __ppoll (fds=0x6030000187f0, nfds=3, timeout=<optimized out>, sigmask=0x0)
at ../sysdeps/unix/sysv/linux/ppoll.c:44
7 Thread 0x7fad44e28700 (LWP 347593) "SDLAudioP2" 0x00007fad73c895b6 in __ppoll (fds=0x60300001c600, nfds=3, timeout=<optimized out>, sigmask=0x0)
at ../sysdeps/unix/sysv/linux/ppoll.c:44
finally, what is using all the cpu time? Turns out ASAN after all. Weird that it is a) so much and b) didn't cause any lag yesterday. Will need to compare this to a fresh process instance.
Samples: 11K of event 'cycles', Event count (approx.): 2641336184, Thread: 1oom_classic_sd
Children Self Command Shared Object Symbol
+ 20.46% 4.11% 1oom_classic_sd 1oom_classic_sdl2 [.] lbxgfx_draw_frame_do ◆
+ 19.74% 19.49% 1oom_classic_sd libc-2.31.so [.] __memmove_sse2_unaligned_erms ▒
+ 16.20% 14.97% 1oom_classic_sd 1oom_classic_sdl2 [.] __asan_memset ▒
+ 11.48% 0.00% 1oom_classic_sd iris_dri.so [.] 0x00007fad6d4b52a6 ▒
+ 10.26% 4.39% 1oom_classic_sd 1oom_classic_sdl2 [.] lbxgfx_draw_frame_offs ▒
+ 9.16% 8.66% 1oom_classic_sd 1oom_classic_sdl2 [.] __asan::QuickCheckForUnpoisonedRegion ▒
+ 8.70% 2.43% 1oom_classic_sd 1oom_classic_sdl2 [.] lbxfont_print_char_ret_x ▒
+ 8.20% 0.03% 1oom_classic_sd 1oom_classic_sdl2 [.] video_update ▒
+ 8.06% 0.01% 1oom_classic_sd 1oom_classic_sdl2 [.] hw_video_draw_buf ▒
+ 7.54% 7.39% 1oom_classic_sd libc-2.31.so [.] __memset_avx2_unaligned_erms ▒