[Solved] Some sysctl values are lost after suspend/resume

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

[Solved] Some sysctl values are lost after suspend/resume

Post by GJones »

Run 'system -w vm.dirty_bytes=5000000'

Suspend the system...

Resume, and vm.dirty_bytes is 0 again.

Put it in sysctl.conf, run 'sysctl -p', suspend and resume... Same thing.

Word is that this is a feature (no, I've no idea how) and will not be fixed. Given that, what is the least kludgy way to make Salix run 'sysctl -p' on resume?
User avatar
aurlaent
Donor
Posts: 106
Joined: 1. Feb 2012, 19:46
Location: Sydney, Australia

Re: Some sysctl values are lost after suspend/resume

Post by aurlaent »

You could create a hook in /etc/pm/sleep.d
https://wiki.archlinux.org/index.php/Pm ... _own_hooks
has some detailed info.
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

Thanks, that's what I was looking for!

Edit: to be fair this is still a kludge, since stuff not in sysctl.conf won't be applied. Even so, it helps.
User avatar
aurlaent
Donor
Posts: 106
Joined: 1. Feb 2012, 19:46
Location: Sydney, Australia

Re: Some sysctl values are lost after suspend/resume

Post by aurlaent »

Sure, but how often are you changing things like that on the fly?
(I guess I haven't found the power of these options)
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

Well, for starters vm.dirty_bytes is rather handy for preventing I/O starvation on desktops, at the expense of disk throughput. It can prevent those scenarios where some program is writing huge batches of stuff to the disk and other programs can't get a word in edgewise. :)
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

Okay, something is going wrong here. sysctl -p is running but the changes are being undone.

Code: Select all

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.
Running hook /etc/pm/sleep.d/00sysctl resume suspend:
vm.dirty_bytes = 5000000
...
# sysctl vm.dirty_bytes
vm.dirty_bytes = 0
00sysctl is properly set +x and looks like this:

Code: Select all

#!/bin/bash
case $1 in
	thaw)
		sysctl -p
		;;
	resume)
		sysctl -p
		;;
	*)
		;;
esac
What am I doing wrong?
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

Hate to do this, but... bump?
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Some sysctl values are lost after suspend/resume

Post by Shador »

Probably something else is running afterwards but I wouldn't know what. You could try this:

Code: Select all

grep -i sysctl /etc/pm/ /usr/lib64/pm-utils/ -r
Apparently this information is from a log:
GJones wrote:

Code: Select all

/usr/lib/pm-utils/sleep.d/01grub resume suspend: success.
Running hook /etc/pm/sleep.d/00sysctl resume suspend:
vm.dirty_bytes = 5000000
...
# sysctl vm.dirty_bytes
vm.dirty_bytes = 0
You could try to get some information from there what is resetting them. Possibly by increasing the verbosity.
Image
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

The only invocation of sysctl I found was this:

Code: Select all

# grep -ir sysctl /usr/lib64/pm-utils/
/usr/lib64/pm-utils/sleep.d/99video:    sysctl -w kernel.acpi_video_flags=$acpi_flag
Which I'm pretty sure is not responsible.
GJones
Donor
Posts: 300
Joined: 22. Jul 2011, 23:27

Re: Some sysctl values are lost after suspend/resume

Post by GJones »

N/M got it, it's /usr/lib64/pm-utils/power.d/laptop-mode (writing directly to /proc/sys/vm/dirty_ratio and whatnot). Overriding that via an empty /etc/pm/power.d/laptop-mode file works okay.
Post Reply