Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure timer slack for 1 second #122

Merged
merged 1 commit into from
Aug 20, 2018
Merged

Conversation

gaul
Copy link
Member

@gaul gaul commented Jul 13, 2017

This allows the kernel scheduler to coalesce wakeups, improving
battery life. Linux defaults to 50 ms slack. Reference:

http://lwn.net/Articles/369549/

@dgraziotin
Copy link
Collaborator

Thanks for this, and for the link. The tests pass, everything seems to be working well. Before merging this, I have a couple questions (mostly because I am no expert here):

  • Does Linux default to 50ms in all (recent) versions?
  • Isn't prctl expecting arg2 to be in nanoseconds?
    • If I got it right, 1000 * 1000 nanoseconds = 1 millisecond = 0.001 seconds. But your commit message claims to change the timer slack to 1 second. I am confused at this point :-)

This allows the kernel scheduler to coalesce wakeups, improving
battery life.  Linux defaults to 50 ms slack.  Reference:

http://lwn.net/Articles/369549/
@gaul
Copy link
Member Author

gaul commented Jul 20, 2017

I corrected arg2 to be 1000 * 1000 * 1000 nsec, or 1 sec. man prctl in Linux 3.13 documents the default at 50 msec.

@sasanj
Copy link

sasanj commented Aug 30, 2017

As per man prctl, the sleep function is not affected, so we should use something like nanosleep, which is addressed in pull request #130.
As a side note, the sleep man page, mentions that in Linux, this function is implemented using nanosleep.
However using nanosleep seems better and safer.

@dgraziotin
Copy link
Collaborator

@gaul do you have any comments about @sasanj suggestion for this one?

@dgraziotin
Copy link
Collaborator

aaand I missed out the other PR. Closing this one. Thanks!

@dgraziotin dgraziotin closed this Oct 4, 2017
@gaul
Copy link
Member Author

gaul commented Oct 4, 2017

Please reopen, this works in conjunction with #130.

@dgraziotin dgraziotin reopened this Oct 5, 2017
@gaul gaul merged commit 6aba92d into linux-on-mac:master Aug 20, 2018
@gaul gaul deleted the timer-slack branch August 20, 2018 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants