RFR : 8215962: Support ThreadPriorityPolicy mode 1 for non-root users on linux/bsd
Baesken, Matthias
matthias.baesken at sap.com
Wed Jan 2 09:11:32 UTC 2019
Hello , please review the following patch .
Currently, when ThreadPriorityPolicy is set to 1 (so called "Aggressive mode"), on linux and bsd(+Mac) a root-user-check (geteuid() != 0)) is done.
See for example the coding in jdk/src/hotspot/os/linux/os_linux.cpp int prio_init().
However the root-user-check has a few drawbacks:
- it blocks the capabilities feature available on current Linux distros (CAP_SYS_NICE capability) that can be used to allow setting lower niceness also for non-root
- setting a higher "niceness" (lower priority) is not possible on Linux for non-root because of the geteuid check
We had a discussion about this in "ThreadPriorityPolicy settings for non-root users" , with this suggestion :
https://mail.openjdk.java.net/pipermail/hotspot-dev/2018-December/035986.html
....
> Just drop the root check for ThreadPriorityPolicy=1 and let the underlying system
> permissions control success or failure.
I did the change in this webrev :
Bug/webrev :
https://bugs.openjdk.java.net/browse/JDK-8215962
http://cr.openjdk.java.net/~mbaesken/webrevs/8215962.0/
Best Regards , Matthias
More information about the hotspot-dev
mailing list