scheduler: group.* options: Process threads as well
Previously threads were not touched when processing group.* options.
Reproducer:
$ cat > a.c << EOF
#define _GNU_SOURCE
#include <pthread.h>
#include <unistd.h>
void *foo(void *unused)
{
pause();
return NULL;
}
int main(void)
{
pthread_t t;
pthread_create(&t, NULL, foo, NULL);
pthread_setname_np(t, "a.out");
pause();
return 0;
}
EOF
$ gcc a.c -pthread
$ mkdir /etc/tuned/test
$ cat > /etc/tuned/test/tuned.conf << EOF
[scheduler]
group.foo=0⭕0:1:a.out
EOF
$ ./a.out &
$ tuned-adm profile test
$ for proc in /proc/$(pgrep a.out)/task/*; do
taskset -p $(basename $proc);
done
pid 29052's current affinity mask: 1
pid 29053's current affinity mask: f <<< should be 1
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
parent
c1bc257563
commit
7bb6ff4d4d
1 changed files with 6 additions and 2 deletions
|
|
@ -126,6 +126,10 @@ class SchedulerPlugin(base.Plugin):
|
|||
cmd = self._get_cmdline(proc)
|
||||
pid = proc["pid"]
|
||||
processes[pid] = cmd
|
||||
if "threads" in proc:
|
||||
for pid in proc["threads"].keys():
|
||||
cmd = self._get_cmdline(proc)
|
||||
processes[pid] = cmd
|
||||
except (OSError, IOError) as e:
|
||||
if e.errno == errno.ENOENT \
|
||||
or e.errno == errno.ESRCH:
|
||||
|
|
@ -446,9 +450,9 @@ class SchedulerPlugin(base.Plugin):
|
|||
if event:
|
||||
read_events = True
|
||||
if event.type == perf.RECORD_COMM:
|
||||
self._add_pid(instance, int(event.pid), r)
|
||||
self._add_pid(instance, int(event.tid), r)
|
||||
elif event.type == perf.RECORD_EXIT:
|
||||
self._remove_pid(instance, int(event.pid))
|
||||
self._remove_pid(instance, int(event.tid))
|
||||
|
||||
@command_custom("ps_whitelist", per_device = False)
|
||||
def _ps_whitelist(self, enabling, value, verify, ignore_missing):
|
||||
|
|
|
|||
Loading…
Reference in a new issue