# schedtool, SCHED_IDLEPRIO and emerge

## Massimo B.

Experimenting with schedtool I thought about if it could be worth running emerge while doing daily work without impact on the overall performance.

I'm running a ck-kernel with MuQSS: sched-MuQSS.txt.

Running schedtool with emerge command that will not be inherited by forked gcc processes, like this?

```
MAKEOPTS="-j2 -l2" FEATURES="-distcc -distcc-pump"  schedtool -D -e emerge -auNDtv world --keep-going --with-bdeps\=y
```

----------

## geki

Well, I cannot help with schedtool, but I run emerge without impacting overall performance by cgroup utils with kernel SCHED_AUTOGROUP, thanks to tholin, like:

```
cgexec -g cpu:idle emerge <command>
```

To set it up you may read tholin's howto in the last paragraph of his post here.

----------

## khayyam

 *Massimo B. wrote:*   

> Running schedtool with emerge command that will not be inherited by forked gcc processes, like this?

 

Massimo B. ...

if you do it internally using portage, then yes , ie, you could do something like the following (and note, you probably want 'ionice' as I/O will also "impact"). 

```
PORTAGE_IONICE_COMMAND="ionice -c 3 schedtool -D \${PID}"
```

HTH & best ... khay

----------

## Massimo B.

 *geki wrote:*   

> 
> 
> ```
> cgexec -g cpu:idle emerge <command>
> ```
> ...

 Interesting purpose for the CGROUPS. However CGROUPS are only part of the mainline kernel CFS. So far I only know docker that is making use of CGROUPS, or multi-user environments, I never thought about enabling for a single user desktop.

 *khayyam wrote:*   

> 
> 
> ```
> PORTAGE_IONICE_COMMAND="ionice -c 3 schedtool -D \${PID}"
> ```
> ...

 Very interesting, didn't know that parameter.

----------

## Massimo B.

Reading about ionice: *Quote:*   

> NOTES
> 
>    Linux supports I/O scheduling priorities and classes since 2.6.13 with the CFQ I/O scheduler.

 

So this one should be ignored by the system as I'm using BFQ currently and like to stay with it after studying benchmarks like this:

https://lwn.net/Articles/600366/

http://algo.ing.unimo.it/people/paolo/disk_sched/results.php

http://algo.ing.unimo.it/people/paolo/disk_sched/extra_results.php

----------

## khayyam

 *Massimo B. wrote:*   

> Reading about ionice: [...] So this one should be ignored by the system as I'm using BFQ currently [...]

 

Massimo B. ... ionice is similarly capable of adjusting BFQ iosched.

best ... khay

----------

## Massimo B.

 *khayyam wrote:*   

> ionice is similarly capable of adjusting BFQ iosched.

 Is that documented somewhere? Searching for ionice and BFQ I can't find reasonable information beside CFQ.

----------

## Ant P.

There's nothing special about CFQ here, CFQ/Deadline/BFQ all support the same IO class API. It's the only one mentioned mainly because it's the only one most users get.

----------

## Massimo B.

 *khayyam wrote:*   

> 
> 
> ```
> PORTAGE_IONICE_COMMAND="ionice -c 3 schedtool -D \${PID}"
> ```
> ...

 

Does this really work as expected? That will run the short command schedtool to set the scheduler of $PID, that single command is run with ionice -c3, but would not apply ionice -c3 to the $PID?

If PORTAGE_IONICE_COMMAND is a command, what about that?

```
PORTAGE_IONICE_COMMAND="ionice -c 3 -p \${PID} && schedtool -D \${PID}"
```

----------

