Re: [systemd-devel] oomd wake-up frequency

2023-08-29 Thread Christian Hergert

On 8/25/23 7:54 AM, Michal Koutný wrote:
I think the loop's event source could be disabled when no cgroups 
require swap monitoring [1] (and enabled lazily when such are configured).


FYI I implemented your design this afternoon in case you have some time 
to review.


https://github.com/systemd/systemd/pull/29011/commits/4806e203aa64bca942a780c4d92ea0b6b51ddd5c

Thanks!

-- Christian



Re: [systemd-devel] oomd wake-up frequency

2023-08-25 Thread Christian Hergert

Thanks for responding! Comments inline.

On 8/25/23 7:54 AM, Michal Koutný wrote:

Do you have any "Swap Monitored CGroups:" in output of `oomctl dump`?


"Swap Monitored CGroups:" appears to be empty on the three physical 
machines I have at my disposal to test. (Fedora 38, Fedora 39, and GNOME 
OS).



I think the loop's event source could be disabled when no cgroups
require swap monitoring [1] (and enabled lazily when such are
configured).


That sounds like a great idea!


Not sure whether/how much SWAP_INTERVAL_USEC could be increased to
retain responsiveness.


Given the empirical evidence here of all these machines not having swap 
monitoring to begin with, I think the interval is less of an issue 
compared to dynamic event sources.


As it were, things like thermald are waking up every 4 seconds when the 
underlying hardware doesn't support async notification. It would be 
fantastic if we had a poll() mechanism that would coalesce the sorts of 
wake-ups across processes.


-- Christian



Re: [systemd-devel] oomd wake-up frequency

2023-08-25 Thread Michal Koutný
Hello.

On Tue, Aug 22, 2023 at 01:59:52PM -0700, Christian Hergert 
 wrote:
> The primary thing I see showing up when profiling an idle system is oomd. My
> casual reading through the code would lead me to believe it's waking up a
> CPU every .15 seconds.

That coincides with swap monitoring timer.

> Is there a way we could have this wake up less? My goal here is to iron out
> all the little things which are causing energy drain when idle.

Do you have any "Swap Monitored CGroups:" in output of `oomctl dump`?

I think the loop's event source could be disabled when no cgroups
require swap monitoring [1] (and enabled lazily when such are
configured). 

Not sure whether/how much SWAP_INTERVAL_USEC could be increased to
retain responsiveness.

HTT,
Michal

[1] 
https://github.com/systemd/systemd/blob/1925f829ab17cee7d65cc8c350d8281f8f41588e/src/oom/oomd-manager.c#L375


signature.asc
Description: PGP signature


[systemd-devel] oomd wake-up frequency

2023-08-22 Thread Christian Hergert

Hi!

Over the past few months I've been working on improving GNOME's 
whole-system profiling story in the form of Sysprof¹.


The primary thing I see showing up when profiling an idle system is 
oomd. My casual reading through the code would lead me to believe it's 
waking up a CPU every .15 seconds.


Is there a way we could have this wake up less? My goal here is to iron 
out all the little things which are causing energy drain when idle.


-- Christian