Giter Club home page Giter Club logo

ananicy's Introduction

Ananicy

Installation

  • logo Arch: AUR/minq-ananicy-git. paru -S minq-ananicy-git or yay -S minq-ananicy-git should do the trick. Don't forget to start and enable the service by running sudo systemctl start ananicy.service and sudo systemctl enable ananicy.service.

For more information click here

What's new?

More, updated and better organised rules.

Support for cmdline in rules added. This is particularly useful for applications that share the same name (looking at you Java). See the freenet rule as an example:

{ "name": "java", "cmdlines": ["freenet.node.NodeStarter"], "type": "service" }

This translates to: apply the rule to any process named java, that received freenet.node.NodeStarter as a command line argument. You can add more than one "cmdlines" in case you want to fine tune your rules.

Old description

Description

Ananicy (ANother Auto NICe daemon) — is a shell daemon created to manage processes' IO and CPU priorities, with community-driven set of rules for popular applications (anyone may add their own rule via github's pull request mechanism). It's mainly for desktop usage.

I just wanted a tool for auto set programs nice in my system, i.e.:

  • Why do I get lag, while compiling kernel and playing games?
  • Why does dropbox client eat all my IO?
  • Why does torrent/dc client make my laptop run slower?
  • ...

Use ananicy to fix these problems!

Versions

X.Y.Z where
X - Major version,
Y - Script version - reset on each major update
Z - Rules version - reset on each script update

Read more about semantic versioning here

Installation

To use ananicy you must have systemd installed.

You can install ananicy manually by:

$ git clone https://github.com/Nefelim4ag/Ananicy.git /tmp/ananicy
$ cd /tmp/ananicy
$ sudo make install
$ git clone https://github.com/Nefelim4ag/Ananicy.git
$ ./Ananicy/package.sh debian
$ sudo dpkg -i ./Ananicy/ananicy-*.deb

Enable

$ sudo systemctl enable ananicy
$ sudo systemctl start ananicy

Configuration

Rules files should be placed under /etc/ananicy.d/ directory and have *.rules extension. Inside .rules file every process is described on a separate line. General syntax is described below:

{ "name": "gcc", "type": "Heavy_CPU", "nice": 19, "ioclass": "best-effort", "ionice": 7, "cgroup": "cpu90" }

All fields except name are optional.

name used for match processes by exec bin name

~ basename $(sudo realpath /proc/1/exe)
systemd

Currently matching by other things is not supported.

You can check what Ananicy sees, by:

ananicy dump proc

Ananicy loads all rules in ram while starting, so to apply rules, you must restart the service.

Available ionice values:

$ man ionice

Simple rules for writing rules

CFQ IO Scheduller also uses nice for internal scheduling, so it's mean processes with same IO class and IO priority, but with different nicceness will take advantages of nice also for IO.

  1. Avoid changing nice of system wide process like initrd.
  2. Please try to use full process name (or name with ^$ symbols like NAME=^full_name$)
  3. When writing rule - try to only use nice, it must be enough in most cases.
  4. Don't try set to high priority! Niceness can fix some performance problems, but can't give you more. Example: pulseaudio uses nice -11 by default, if you set other cpu hungry task, with nice {-20..-12} you can catch a sound glitches.
  5. For CPU hungry backround task like compiling, just use NICE=19.

About IO priority:

  1. It's useful to use {"ioclass": "idle"} for IO hungry background tasks like: file indexers, Cloud Clients, Backups and etc.
  2. It's not cool to set realtime to all tasks. The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. So try to use ioclass first.

Debugging

Get ananicy output with journalctl:

$ journalctl -efu ananicy.service

Missing schedtool

If you see this error in the output

Jan 24 09:44:18 tony-dev ananicy[13783]: ERRO: Missing schedtool! Abort!

Fix it in Ubuntu with

sudo apt install schedtool

Submitting new rules

Please use pull request, thanks

ananicy's People

Contributors

adworacz avatar agireud avatar alexdewar avatar atrate avatar birdthatcantfly avatar coledot avatar filipopo avatar francoism90 avatar gauravjuvekar avatar grasegger avatar haron-prime avatar hsmalley avatar in-line avatar izissise avatar kfeoktistoff avatar liberodark avatar naufalw avatar nefelim4ag avatar nightbane112 avatar openglfreak avatar ryanmusante avatar saswotlamichhane avatar seketh avatar shoober420 avatar techcable avatar terencode avatar themadprofessor avatar thermi avatar wilbowma avatar xratix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ananicy's Issues

Small installation problem, of late

As you can see from the below, I had to jump a hoop or two to get the most recent version installed (on Mint).

~ $ git clone https://github.com/Nefelim4ag/Ananicy.git /tmp/ananicy
Cloning into '/tmp/ananicy'...
remote: Counting objects: 512, done.
remote: Total 512 (delta 0), reused 0 (delta 0), pack-reused 512
Receiving objects: 100% (512/512), 88.11 KiB | 0 bytes/s, done.
Resolving deltas: 100% (248/248), done.
Checking connectivity... done.
~ $ sudo /tmp/ananicy/install.sh
[sudo] password for nicholas: 
sudo: /tmp/ananicy/install.sh: command not found
~ $ cd /tmp/ananicy
/tmp/ananicy $ ls
ananicy  ananicy.d  ananicy.service  LICENSE  Makefile  package.sh  README.md
/tmp/ananicy $ cp /home/nicholas/Ananicy/install.sh /tmp/ananicy
/tmp/ananicy $ ./install.sh
/tmp/ananicy $ sudo systemctl restart ananicy
Warning: ananicy.service changed on disk. Run 'systemctl daemon-reload' to reload units.
/tmp/ananicy $ sudo systemctl daemon-reload

Apologies if it is my mistake. By the way, I like your most recent commit: it well help keep my logs tidy.

Ananicy keeps initializing itself again

Started after 6cacf27, Ananicy keeps initializing itself every minute:

mai 08 22:34:49 terence-arch ananicy[16191]: INFO: Check /etc/ananicy.d/ dir
mai 08 22:34:48 terence-arch systemd[1]: Started Ananicy - ANother Auto NICe daemon.
mai 08 22:34:48 terence-arch systemd[1]: Stopped Ananicy - ANother Auto NICe daemon.
mai 08 22:34:48 terence-arch systemd[1]: ananicy.service: Service hold-off time over, scheduling restart.

mai 08 22:35:43 terence-arch ananicy[16840]: INFO: Check /etc/ananicy.d/ dir
mai 08 22:35:43 terence-arch systemd[1]: Started Ananicy - ANother Auto NICe daemon.
mai 08 22:35:43 terence-arch systemd[1]: Stopped Ananicy - ANother Auto NICe daemon.
mai 08 22:35:43 terence-arch systemd[1]: ananicy.service: Service hold-off time over, scheduling restart.

mai 08 22:36:37 terence-arch ananicy[19199]: INFO: Check /etc/ananicy.d/ dir
mai 08 22:36:37 terence-arch systemd[1]: Started Ananicy - ANother Auto NICe daemon.
mai 08 22:36:37 terence-arch systemd[1]: Stopped Ananicy - ANother Auto NICe daemon.
mai 08 22:36:37 terence-arch systemd[1]: ananicy.service: Service hold-off time over, scheduling restart

Is it the expected behaviour?

Excessive logging

Sorry to raise this in the form of an 'issue', but I couldn't see how else to get help.

Ananicy logs all the adjustments it makes, in the main system log, and in my log those recordings are getting a bit out of hand. How to tell Ananicy to log only errors? Thanks.

Transmission rules

Add these rules, please

NAME=transmission-remote TYPE=BG_CPUIO
NAME=transgui TYPE=BG_CPUIO
NAME=transmission-cli TYPE=BG_CPUIO

Regards.

Suggestion f

Much of the current text is hard to understand and (/because) not the best English. I suggest that you change

Ananicy Rare/Often Frequency scaling
Ananicy have 2 threads, if nothing match rule for 5 Min
Rule moved to low requency check thread (rare)
If rule from RARE thread match something,
it's moved to OFTEN thread

to the following.

On the frequency with which Ananicy performs its checks

Ananicy has two threads. Each thread checks whether any process matches Ananicy's rules.
However, one thread - the often thread - checks regularly
(namely, at the time specified by the CHECK_FREQ variable, above).
The other thread - the rare thread - checks much less frequently.
All rules begin on the often thread.
If a rule matches no process for five minutes,
then that rule is demoted to the rare thread.
If a rule running within the rare thread matches a process,
then that rule is restored to the often thread.

One could elaborate the above text so as to explain, or begin to explain, the other comments in the conf file.

EDIT: Sorry for the title of this comment; I pressed return by accident.

Please consider adding the following to your wiki page

(1) How long it takes to apply a newly created rule, and whether one needs to restart the service to do so.

(2) The available IONICE values (normal, idle and realtime?)

Also (3) to submit a rule to you, I should use a 'pull request', yes?

Thanks.

Power drain/high CPU usage as reported by PowerTOP

When running Ananicy on an Intel Core i7-3610QM (8 threads) notebook PC, PowerTOP shows higher CPU usage when the machine is otherwise idle leading to increased power usage. Is there anything that can be done to make this more efficient?

Output with Ananicy running:

Summary: 959.4 wakeups/second,  0.4 GPU ops/seconds, 0.0 VFS ops/sec and 20.0% CPU use
2.72 W    234.8 ms/s     205.2        Process        ananicy

Output after stopping Ananicy (systemctl stop ananicy):
Summary: 338.6 wakeups/second, 0.5 GPU ops/seconds, 0.0 VFS ops/sec and 4.8% CPU use

Bug -- Traceback ananicy.service failed PermissionError

Traceback on recent boot pointing to PermissionError: [Errno 13]. Rules are all defaults from last upgrade.

May 28 11:48:50 xmg ananicy[474]: Traceback (most recent call last):
May 28 11:48:50 xmg ananicy[474]:   File "/usr/bin/ananicy", line 726, in <module>
May 28 11:48:50 xmg ananicy[474]:     main(sys.argv)
May 28 11:48:50 xmg ananicy[474]:   File "/usr/bin/ananicy", line 709, in main
May 28 11:48:50 xmg ananicy[474]:     daemon.run()
May 28 11:48:50 xmg ananicy[474]:   File "/usr/bin/ananicy", line 650, in run
May 28 11:48:50 xmg ananicy[474]:     self.proc_map_update()
May 28 11:48:50 xmg ananicy[474]:   File "/usr/bin/ananicy", line 527, in proc_map_update
May 28 11:48:50 xmg ananicy[474]:     for pid in self.proc_get_pids():
May 28 11:48:50 xmg ananicy[474]:   File "/usr/bin/ananicy", line 495, in proc_get_pids
May 28 11:48:50 xmg ananicy[474]:     if not os.path.realpath("/proc/{}/exe".format(pid)):
May 28 11:48:50 xmg ananicy[474]:   File "/usr/lib/python3.6/posixpath.py", line 388, in realpath
May 28 11:48:50 xmg ananicy[474]:     path, ok = _joinrealpath(filename[:0], filename, {})
May 28 11:48:50 xmg ananicy[474]:   File "/usr/lib/python3.6/posixpath.py", line 436, in _joinrealpath
May 28 11:48:50 xmg ananicy[474]:     path, ok = _joinrealpath(path, os.readlink(newpath), seen)
May 28 11:48:50 xmg ananicy[474]: PermissionError: [Errno 13] Permission denied: '/proc/15895/exe'
May 28 11:48:50 xmg systemd[1]: ananicy.service: Main process exited, code=exited, status=1/FAILURE
May 28 11:48:50 xmg systemd[1]: ananicy.service: Failed with result 'exit-code'.
May 28 11:48:50 xmg systemd[1]: ananicy.service: Consumed 782ms CPU time
May 28 11:48:51 xmg systemd[1]: ananicy.service: Service hold-off time over, scheduling restart.
May 28 11:48:51 xmg systemd[1]: ananicy.service: Scheduled restart job, restart counter is at 1.
May 28 11:48:51 xmg systemd[1]: Stopped Ananicy - ANother Auto NICe daemon.
May 28 11:48:51 xmg systemd[1]: ananicy.service: Consumed 782ms CPU time
May 28 11:48:51 xmg systemd[1]: Starting Ananicy - ANother Auto NICe daemon...

Config file ambiguity

# Verbose msg: true/false
cgroup_load=false
type_load=false
rule_load=false

apply_nice=true
apply_ioclass=true
apply_ionice=true
apply_sched=true
apply_oom_score_adj=true
apply_cgroup=true

Is the second set of options - which starts apply_nice=true to do with logging, please? Or to do with actual actions? It's not clear from the file, though I think that that this second group is in fact, still, to do with logging.

Rules not being applied anymore

It only works for ananicy itself but nothing is applied for all the other programs.
I tried reverting to an old version but it's not working, making me thinking it's something with my system.
The log is clean, I see at start

avril 15 16:27:43 terence-arch systemd[1]: Started Ananicy - ANother Auto NICe daemon.
avril 15 16:27:43 terence-arch ananicy[22006]: INFO: Start main process
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[22006] ioclass: none  -> idle
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[22006] sched: normal -> idle
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[23791] ioclass: none  -> idle
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[23791] sched: normal -> idle
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[23792] ioclass: none  -> idle
avril 15 16:27:44 terence-arch ananicy[22006]: INFO: Process ananicy[23792] sched: normal -> idle

but that's it, nothing else.
I tried to do sudo ananicy dump rules && sudo ananicy dump types but it did nothing.

Disabling logging - is it broken?

With a recent build (built from git) - but also, perhaps, with earlier builds - the following config

## Ananicy configuration
CHECK_FREQ=0.2s

## Logging
INFO_MSG_NICE_ENABLED=false
INFO_MSG_IOCLASS_ENABLED=false
INFO_MSG_IONICE_ENABLED=false
INFO_MSG_SCHED_ENABLED=false
INFO_MSG_OOM_SCORE_ADJ_ENABLED=false

does not prevent much

INFO: Parse /etc/ananicy.d/vlc.rules

and the like from occuring in my logs, when I do

sudo systemctl restart ananicy

Is that as it should be?

Linux Mint 18.1 x64 Cinnamon.

Re-nicing python scripts?

Ananicy doesn't appear to implement the following rule.

# Rules for angrysearch_update_database.py 
NAME=angrysearch_update_database.py   NICE=8   IOCLASS=idle

Perhaps I am doing something wrong, or perhaps Ananicy can't act on particular interpreted scripts. Or should I have something like

NAME="python angrysearch_update_database.py" NICE=8 IOCLASS=idle

?

(If this doesn't really count, as stands, as a bug report, then we could class it as a problem with the documentation - unless I overlook something in the documentation.)

Ananicy failed to start due to AttributeError

Ananicy tries to reference an attribute which no longer exist. This error has occured since commit 116f30b.

 Traceback (most recent call last):
   File "/usr/bin/ananicy", line 716, in <module>
     main(sys.argv)
   File "/usr/bin/ananicy", line 698, in main
     daemon = Ananicy()
   File "/usr/bin/ananicy", line 228, in __init__
     self.run_cmd(["systemd-notify", "--ready"])
 AttributeError: 'Ananicy' object has no attribute 'run_cmd'

pulseaudio spamming

When I run journalctl -f, I can see a lot of ananicy message like this every few minutes:

nov. 16 13:51:35 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[2954] ioclass: realtime  -> realtime
nov. 16 13:51:35 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[2969] ioclass: realtime  -> realtime
nov. 16 13:51:35 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[2970] ioclass: realtime  -> realtime
nov. 16 13:51:36 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[2971] ioclass: realtime  -> realtime
nov. 16 13:51:36 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[3292] ioclass: realtime  -> realtime
nov. 16 13:51:36 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[3312] ioclass: realtime  -> realtime
nov. 16 13:51:37 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[3313] ioclass: realtime  -> realtime
nov. 16 13:51:37 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[3314] ioclass: realtime  -> realtime
nov. 16 13:52:14 leeo-arch-pc ananicy[884]: INFO: Process pulseaudio[2954] ioclass: realtime  -> realtime

I want to know why because my logs become unreadable. And if it's not a real problem, how can I prevent the spam?

TVHeadend rules

Could you please add TVHeadend rules? This may help against stutter. :)

Thanks.

Single config file to enable/disable specific preferences.

It may be inconvenient for the user to have all of the settings enabled all of the time, as well as delete them manually after every single update. So it seems to me that a config file should be present to enable or disable certain preferences, e.g. something like

# /etc/ananicy.conf
[global]
ignored=00-skype,00-xz

Feature - oom-killer score adjustment.

Hi.
I was looking for a systematic way to adjust oom killer score for some crucial processes run on my system

sometimes i have like a mesh reconstruction job witch can take up to couple of hours and have peek memory consumption close to 20GB - witch i don't wont to get killed when i open google-chrome (which should have its oom_adj boosted to 10 at least)

...and I thought about annanicy which makes life easier for my HDD. Similar feature for RAM would be the oom-killer score adjustment. This could prevent someones blender job from being "canceled" because it's get less "score" than some leftover chrome tabs :(
regard.bartus

WarThunder profile (NAME=aces) might match other processes

I get a lot of logs for the nice value adjustment of "aces" processes, even when I don't play WT. I suspect the NAME value matches other processes but WT, too. I didn't catch any others, but the logs make it obvious. It'd be great if other persons with information about this could post it here and maybe we could find a solution, if it is a problem. I see the NICE value being changed from 19 to -5 and 0 to -5.

Bug -- Processes listed in ps/top won't work from rules

After a recent system upgrade, some processes list python2 or python3 next to their command as in /usr/bin/python2 /usr/bin/terminator.

Now { "name": "terminator","type": "LowLatency_RT" } won't call the process.

What is the proper way to configure this in rules?

sudo ananicy dump proc produces an error

$ sudo ananicy dump proc
Traceback (most recent call last):
  File "/usr/bin/ananicy", line 716, in <module>
    main(sys.argv)
  File "/usr/bin/ananicy", line 712, in main
    daemon.dump_proc()
  File "/usr/bin/ananicy", line 660, in dump_proc
    self.update_proc_map()
AttributeError: 'Ananicy' object has no attribute 'update_proc_map'

Linux Mint 18.3 x64 Cinnamon. Ananicy ??. (I don't know how to get the version number for ananicy.)

Bug -- Disk scheduler not used cfq/bfq warning

Both drives are set to deadline scheduler. Should this warning message be ignored? Is it deprecated from earlier version?

"WARN: Disk sda not used cfq/bfq scheduler IOCLASS/IONICE will not work on it!"

cgroup permission error

avril 22 14:21:25 terence-arch ananicy[25480]: OSError: [Errno 30] Read-only file system: '/sys/fs/cgroup/cpu,cpuacct'
avril 22 14:21:25 terence-arch ananicy[25480]: mkdir(name, mode)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/lib/python3.6/os.py", line 220, in makedirs
avril 22 14:21:25 terence-arch ananicy[25480]: makedirs(head, mode, exist_ok)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/lib/python3.6/os.py", line 210, in makedirs
avril 22 14:21:25 terence-arch ananicy[25480]: os.makedirs(self.work_path)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 41, in init
avril 22 14:21:25 terence-arch ananicy[25480]: self.cgroups[cgroup] = CgroupController(cgroup, cpuquota)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 240, in get_cgroup_info
avril 22 14:21:25 terence-arch ananicy[25480]: self.get_cgroup_info(line)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 217, in load_cgroups
avril 22 14:21:25 terence-arch ananicy[25480]: self.load_cgroups()
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 117, in init
avril 22 14:21:25 terence-arch ananicy[25480]: daemon = Ananicy()
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 595, in main
avril 22 14:21:25 terence-arch ananicy[25480]: main(sys.argv)
avril 22 14:21:25 terence-arch ananicy[25480]: File "/usr/bin/ananicy", line 613, in
avril 22 14:21:25 terence-arch ananicy[25480]: Traceback (most recent call last):
avril 22 14:21:25 terence-arch ananicy[25480]: Load types: /etc/ananicy.d//00-cgroups.cgroups

Regression: Steam rules not working

When a game included in _steam.rules starts, it does Process steam[10430] cpu nice: -5 -> 19 instead of apply a negative nice value to the game process.
I bisected the commit introducing the regression: 5e83682

Ananicy is slow and drains battery

Ananicy is slow and drains battery. Is 0.2s CHECK_FREQ default parameters really expected/required? Won't 15s or 30s do fine for most setups?

Attractive software, but there's a mistake in the instructions and the program does not appear to work

Your instructions for Debian/Ubuntu are:

$ git clone https://github.com/Nefelim4ag/Ananicy.git
$ ./Ananicy/package.sh debian
$ dpkg -i ./Ananicy/ananicy-*.deb

But, on my (Mint) system, the last line threw an error. For it needs to be run as root.
(Also, it takes a while to realise that the initial instructions - the ones preceeding your mention of Arch - are not to be followed on Debian or Ubuntu.)

Worse: having followed the instructions (and run the last line as root) and rebooted, nothing is being re-niced; I tested with Skype and Smplayer.

Applying resource limits on process creation

I think we can all agree that it's a problem that ananicy doesn't apply the settings right away when a process is created. That is because it runs each rule with pgrep and other applications at a time with a sleep time in between the calls. That is to ensure that ananicy does not take up too much CPU time. A better solution would be to either have the settings be applied at process creation or shortly after.

There are two possible solutions to do this:

  • Dynamically create wrapper scripts in /usr/local/bin that call the process with the arguments, but with nice and other applications prior to apply the settings.
    That should work fine for interpreted languages, too, because the called script is visible in the passed arguments. E.g. python foo.py or mono --debug /usr/lib/smuxi/smuxi-frontend-gnome.exe, in the case of the Smuxi IRC/Chat client.
    That would necessitate the creation of those files, obviously, which is disk IO. It is possible to fix this possible issue by using overlayfs to create the wrapper scripts in a virtual (memory only) file system, so no disk IO is performed when the rules are loaded. That would entail mounting said overlayfs over /usr/local/bin. This solution could be worked around by calling the applications by their name (/bin/gcc). If that is no problem, this solution seems to be good.

  • Set the values at process creation in kernel space. The idea is to cache the rule set in kernel space and apply the rules when the process is created. It is necessary to hook that event, which I don't know how.

Add option to disable/enable all verbosity options

It would be more convenient when you want to have a silent log -which most people want- without needing to replace all the 'true' by 'false'.

I think disabling all the messages should be the default (maybe keep the loading log?).

Guidelines for .rules

I think we need to list used values used for various categories of apps in README. It will be easier to add new rules and also to migrate from another renice daemon or custom script.

Disabling ananicy for some child processes... aka garbled vim display?

Hi,
I've been using Ananicy for a while and had no issues. Recently, I made up some rules for my DE processes to give them real-time nice. However, that meant that every child started by the DE received real-time nice as well. So my terminal program received real-time nice and then vim received them as well.

Now, when I edit files with vim, my status bar and display is completely garbled because anancy is applying nice and for some reason the message is being sent to the terminal session. After I quit vim, I see something like home/fairw/.zlogin:9: nice(5) failed: success.

Anyone have any ideas how to fix this? Thank you!

Reducing verbosity?

Hi all,
My journal is full of ananicy "INFO" messages. Is there a way to suppress those and only show errors?
Thanks!

Can't start the service on Raspbian last version

I can install and use before Ananicy but with the last version this is the result I obtain when I'm going to strart the service:

$ sudo systemctl enable ananicy
$ sudo systemctl start ananicy
Job for ananicy.service failed. See 'systemctl status ananicy.service' and 'journalctl -xn' for details.

Yes is a Raspberry but the OS in the end is a modded Debian:

uname -a
Linux raspberrypi 4.9.28-v7+ #998 SMP Mon May 15 16:55:39 BST 2017 armv7l GNU/Linux

and

lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 8.0 (jessie)
Release:	8.0
Codename:	jessie

Any idea about how I can't resolve this?

Thanks

Request -- Cinnamon rules add

Request add cinnamon.rules:

# Cinnamon Desktop
{ "name": "cinnamon",			"type": "LowLatency_RT" }
{ "name": "cinnamon-session",		"type": "LowLatency_RT" }
{ "name": "cinnamon-killer-daemon",	"type": "LowLatency_RT" }
{ "name": "cinnamon-launcher",		"type": "LowLatency_RT" }
{ "name": "cinnamon-screensaver",	"type": "BG_CPUIO" }
{ "name": "cinnamon-settings-daemon",	"type": "BG_CPUIO" }

Feature Request -- Addition to Repositories

In my opinion, this utility should be in most distributions main repositories.

It is not just for convenience but in many cases, necessity.

What does it take for this to happen?

Unable to match process with space

I'm not able to match the following process:

"6883": {
"tpid": 6883,
"exe": "/usr/bin/pianoteq 6",
"cmd": "pianoteq 6",
"nice": 0,
"oom_score_adj": 0,
"stat": "6883 (Pianoteq STAGE) S 13537 13477 13477 1026 13477 1077936192 35 538 0 0 17086 191 0 0 -66 0 8 0 7261007 864665600 75982 18446744073709551615 4194304 48096598 140734162512208 0 0 0 4096 16777216 16896 0 0 0 -1 0 65 2 0 0 0 50197376 50665096 72962048 140734162520335 140734162520346 140734162520346 140734162522084 0",
"cmdline": "pianoteq 6"
}

I tried using NAME="pianoteq" TYPE=LowLatency_RT as advised in #83 but it's not working.

Crash: List index out of range

avril 19 14:45:28 terence-arch systemd[1]: ananicy.service: Main process exited, code=exited, status=1/FAILURE
avril 19 14:45:28 terence-arch ananicy[7879]: IndexError: list index out of range
avril 19 14:45:28 terence-arch ananicy[7879]: return stdout[1].rstrip()
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 342, in get_ionice
avril 19 14:45:28 terence-arch ananicy[7879]: c_ionice = self.get_ionice(pid)
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 357, in ionice
avril 19 14:45:28 terence-arch ananicy[7879]: self.ionice(proc, pid, rule["ionice"])
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 441, in process_pid
avril 19 14:45:28 terence-arch ananicy[7879]: self.process_pid(proc, pid)
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 450, in processing_rules
avril 19 14:45:28 terence-arch ananicy[7879]: self.processing_rules()
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 455, in run
avril 19 14:45:28 terence-arch ananicy[7879]: daemon.run()
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 485, in main
avril 19 14:45:28 terence-arch ananicy[7879]: main(sys.argv)
avril 19 14:45:28 terence-arch ananicy[7879]: File "/usr/bin/ananicy", line 498, in
avril 19 14:45:28 terence-arch ananicy[7879]: Traceback (most recent call last):

Request -- Rules files integrated into single conf

Request the option for a single file with all ".rules" integrated. I prefer if an ananicy-rules.conf or something similar could be created vice the creation of so many separate files that have to be parsed.

Processes with spaces are not recognized

I am having a problem with a process called "PHP Server Language".
I use the folowing config { "name": "PHP Language Server", "type": "BG_CPUIO" }
When looking for a solution, I discovered that ananicy breaks the process name by spaces.
Is there any way to disable space-breaking? Why can not I use \ to escape the command?

ananicy dump proc outputs something like this

    "15878": {
        "pid": 15878,
        "tpid": 15878,
        "exe": "/usr/bin/php",
        "cmd": "php",
        "stat": "15878 (php) S 15861 15861 15861 0 -1 4194304 8572 0 0 0 1923 56 0 0 39 19 1 0 575055 790843392 133135 18446744073709551615 94786342731776 94786355250896 140723567249296 0 0 0 0>
        "nice": 19,
        "sched": "normal",
        "ionice": [
            "none: prioridade 4",
            null
        ],
        "oom_score_adj": 0,
        "cmdline": [
            "PHP",
            "Language",
            "Server"
        ]
    },

The new(ish) Cinnamon rules look a bit aggressive . .

. . and I think they might be slowing down the speed with which keystrokes appear on my screen. Can you shed any light, please?

By 'aggressive' (in my title) I mean: it seems that the Cinnamon rules mess with lots of rather fundamental Cinnamon processes.

Bug -- pulseaudio rules conflict with daemon.conf

Pulseaudio.rules is a redunant rules file when pulse audio has it's own configuration file. Furthermore, it seems to conflict on my system causing an audible popping sound that can only be fixed by disabled the rules file.

/etc/pulse/daemon.conf

high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5

Rules match based on any argument

_steam.rules contains a line which matches for the Planetary Annihilation game
by searching for the name PA

On my system, a couple of scripts run with an argument like PATH=... which is how I came
to notice this strange behavior.

Commands which run with any kind of argument looking like ...PA... will match with the
_steam.rules file and be run under TYPE=GAME incorrectly. This is because pgrep -f -w PA
matches any command whose full name includes the text PA anywhere in it.

This can be most easily observed with the following:

[in one terminal]
$ vim PATH

[in another terminal]
$ pgrep -f -w PA

Ananicy will also log to the system journal that it is setting nice levels to -5 for the random vim process.

I have fixed this on my system by changing the PA line in _steam.rules to ^PA$ but I am
unsure if this has any negative side effects since I do not actually run Planitary Anihilation.

Restarting the service does not show rule errors

My rules were in the old format. (Nothing had told me there was a new format!) Hence they failed. However, I realised this only when running sudo ananicy dump proc. For sudo service ananicy restart produced no error. Perhaps no error was display because I have the following in my .conf:

# Verbose msg: true/false
cgroup_load=false
type_load=false
rule_load=false

apply_nice=true
apply_ioclass=true
apply_ionice=true
apply_sched=true
apply_oom_score_adj=true
apply_cgroup=true

Surely, though, errors should be logged even when ananicy is set not to report anything else.

Slow shutdown

When my computer shutsdown, and I make the shutdown process visible, I see that Ananicy takes a couple of seconds to shut down. I'd like to speed up my shutdown (which, on my admittedly fairly underpowered, but lean computer, takes seven to fifteen seconds); so, can anything be done about this, please? Thanks.

Ananicy 1.3.0

Linux Mint 18.1 Serena x86_64
Kernel: 4.10.0-20-generic

Upgrade of Ananicy replaces removed rules files

What is the best option to prevent particular rules from being parsed at boot? ## Comment them out in the rules file? With each install, the files that I have deleted are automatically reinstalled to the location and added to the queue, if they are overwritten than they will lose the previous configuration.

It is unclear how to use a pull request to submit new rules, at least if one haven't done a pull request before

Given the problem expressed by my title, I am putting my proposed rules here.

# Cairo-dock rules. Cairo-dock is a dock application; see https://www.glx-dock.org/
NAME=cairo-dock            NICE=-1
# Rules for clamav components. Clamav is a well-know antivirus for Linux.
NAME=clamtk NICE=-1
NAME=clamscan NICE=3 IOCLASS=best-effort IONICE=6
# Rules for Conky. Conky display system information on the desktop; https://github.com/brndnmtthws/conky
NAME=conky           NICE=1
# gdebi-gtk rules. Gdebi installs Debian packages.
NAME=gdebi-gtk NICE=1 IOCLASS=best-effort IONICE=5
# gnome-system-monitor. This monitor is used in many Linux distributions and in the Gnome desktop environment.
NAME=gnome-system-monitor            NICE=1
# Rules for systemback - a system restore program; https://sourceforge.net/projects/systemback/
NAME=systemback      NICE=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.