Age | Commit message (Collapse) | Author | Files | Lines |
|
new functionality, new version :)
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Add cannot_set_affinity and cannot_set_thread_affinity from tuna
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
trying to keep setup.py and rpm specfile coherent :)
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
added scripts to setup.py, pflags renamed and added to setup.py
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
We need to specify new dependency on `six` module with
`install_requires` which is supported via setuptools.
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Moreover, `file()` is not available in Python 3.
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
This adds the first unit test to python-linux-procfs
It adds the bitmasklist_test for testing the function bitmasklist, which
is called by parse_affinity. Unlike parse_affinity, the number of cpus
is not detected, so the unit test can simulate different numbers of
cpus.
This is an expanded form of a reproducer from Jozef Bacik from
Bugzilla 1365902
If we add more unit tests in the future (we should), then we can
consider some kind of python package scheme, but for now this can live
in the base directory.
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
The function parse_affinity reports wrong results for CPU numbers
greater than 31.
The problem is caused by the function bitmastlist which parse_affinity
calls. The fix treats the inpput line as a long hexbitmask instead of an
array in order to produce correct results
Signed-off-by: Jozef Bacik <jobacik@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: John Kacur <jkacur at redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Mention python-perf as an alternative way of noticing thread lifetime
events (FORK, EXIT).
Requested-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@edhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
So that we can use procfs.cmdline()["BOOT_IMAGE"], for instance.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
So that we can do:
>>> import procfs
>>> processes = procfs.pidstats()
>>> sshd = processes.find_by_name("sshd")
>>> print sshd_maps[0].perms
>>> sshd_maps = procfs.smaps(sshd[0])
>>> print sshd_maps[0].perms
r-xp
I.e. access it like an array.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Getting the process flags documentation from the kernel
include/linux/sched.h file, that is what 'man procfs' references when
describing the processor flags in /proc/PID/stat.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
It is the last field, in CSV format, and that was what was being parsed,
but in a convoluted way, fixing it also simplified it.
Buggy:
[root@zoo ~]# tuna -Q
# users affinity
0 2-edge timer 0,1,2,3
8 8-edge rtc0 0,1,2,3
9 9-fasteoi acpi 0,1,2,3
17 17-fasteoi brcmsmac 0,1,2,3
22 22-fasteoi ehci_hcd:usb4 0,1,2,3
23 23-fasteoi ehci_hcd:usb3 0,1,2,3
26 2146304-edge pciehp 0,1,2,3
27 2162688-edge pciehp 0,1,2,3
28 2179072-edge pciehp 0,1,2,3
29 2195456-edge pciehp 0,1,2,3
30 512000-edge 0000:00:1f.2 0,1,2,3
31 327680-edge xhci_hcd 0,1,2,3
32 32768-edge i915 0,1,2,3
33 360448-edge mei_me 0,1,2,3
34 2621440-edge thunderbolt 0,1,2,3
35 442368-edge snd_hda_intel 0,1,2,3
[root@zoo ~]#
Fixed:
# tuna -Q
# users affinity
0 timer 0,1,2,3
8 rtc0 0,1,2,3
9 acpi 0,1,2,3
17 brcmsmac 0,1,2,3
22 ehci_hcd:usb4 0,1,2,3
23 ehci_hcd:usb3 0,1,2,3
26 pciehp 0,1,2,3
27 pciehp 0,1,2,3
28 pciehp 0,1,2,3
29 pciehp 0,1,2,3
30 0000:00:1f.2 0,1,2,3
31 xhci_hcd 0,1,2,3
32 i915 0,1,2,3
33 mei_me 0,1,2,3
34 thunderbolt 0,1,2,3
35 snd_hda_intel 0,1,2,3
#
Reported-by: Flavio Leitner <fbl@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1245677
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
The load method was just splitting the fields using space as the
separator, but since some COMM names started having spaces... We
better use the () as the COMM "quotes", using spaces as the
separator for the remaining fields.
Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
E.g.:
$ ./pflags-cmd.py ssh*,bash,6941
1278 sshd RANDOMIZE|SUPERPRIV|USED_ASYNC|USED_MATH
2692 bash RANDOMIZE|USED_ASYNC|USED_MATH
2919 bash RANDOMIZE|SUPERPRIV|USED_ASYNC|USED_MATH
3116 bash RANDOMIZE|USED_ASYNC|USED_MATH
3149 bash RANDOMIZE|USED_ASYNC|USED_MATH
3384 bash RANDOMIZE|USED_ASYNC|USED_MATH
3579 bash RANDOMIZE|USED_ASYNC|USED_MATH
3834 ssh RANDOMIZE|USED_ASYNC|USED_MATH
4372 bash RANDOMIZE|USED_ASYNC|USED_MATH
5024 bash RANDOMIZE|USED_ASYNC|USED_MATH
6339 bash RANDOMIZE|USED_ASYNC|USED_MATH
6941 vim FREEZER_SKIP|RANDOMIZE|USED_ASYNC|USED_MATH
$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Adding the ones found in the v4.1-rc kernel.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
It was referencing self.flags, that doesn't exists, fix it by making it
access self.fields["flags"] instead.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
I.e. let the OS be the one to decide if access to this file is allowed
or not, and non root users can see this, at least around 4.1-rc times:
Running: procfs/procfs.py:
31: {'affinity': [0, 1, 2, 3], 'type': 'PCI-MSI-edge', 'cpu': [178564, 0, 285828, 0], 'users': ['xhci_hcd']}
30: {'affinity': [0, 1, 2, 3], 'type': 'PCI-MSI-edge', 'cpu': [342630, 0, 197229, 0], 'users': ['0000:00:1f.2']}
35: {'affinity': [0, 1, 2, 3], 'type': 'PCI-MSI-edge', 'cpu': [858, 0, 565, 0], 'users': ['snd_hda_intel']}
34: {'affinity': [0, 1, 2, 3], 'type': 'PCI-MSI-edge', 'cpu': [306, 0, 44, 0], 'users': ['thunderbolt']}
And now 'tuna -Q' works for non root users:
[acme@zoo python-linux-procfs]$ ../tuna/tuna-cmd.py -Q
# users affinity
0 timer 0,1,2,3
8 rtc0 0,1,2,3
9 acpi 0,1,2,3
17 17-fasteoi brcmsmac 0,1,2,3
22 22-fasteoi ehci_hcd:usb4 0,1,2,3
23 23-fasteoi ehci_hcd:usb3 0,1,2,3
26 pciehp 0,1,2,3
27 pciehp 0,1,2,3
28 pciehp 0,1,2,3
29 pciehp 0,1,2,3
30 0000:00:1f.2 0,1,2,3
31 xhci_hcd 0,1,2,3
32 i915 0,1,2,3
33 mei_me 0,1,2,3
34 thunderbolt 0,1,2,3
35 snd_hda_intel 0,1,2,3
[acme@zoo python-linux-procfs]$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
For the stat flag that means that userland is not allowed to meddle with
cpus_allowed, i.e. with the thread's smp affinity, via
sched_setaffinity.
This indeed has the same value as PF_THREAD_BOUND, see the kernel
sources for an explanation, but basically was in this cset:
commit 14a40ffccd6163bbcd1d6f32b28a88ffe6149fc6
Author: Tejun Heo <tj@kernel.org>
Date: Tue Mar 19 13:45:20 2013 -0700
sched: replace PF_THREAD_BOUND with PF_NO_SETAFFINITY
PF_THREAD_BOUND was originally used to mark kernel threads which
were bound to a specific CPU using kthread_bind() and a task with
the flag set allows cpus_allowed modifications only to itself.
Workqueue is currently abusing it to prevent userland from meddling
with cpus_allowed of workqueue workers.
---------------------------------------------------------------
So add the new const but keep the old one, we may have some tool out
there using it.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Jiri Kastner <jkastner@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Petr Oros <poros@redhat.com>
|
|
Recent kernels (detected on 3.9.0-rc2) have a VmFlags field that has
string flags that broke the detection of multiple memory maps.
Fix it by checking for a ':' as the last character of the first
token in the split() line.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
When the process vanishes after we got a list of pids that match some
criteria, just catch it, remove it from the pid dictionary and continue.
Reported-by: Clark Williams <williams@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reviewed-by: Parag AN(पराग) <panemade@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Part of the fedora review process.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Reported-by: Guy Streeter <streeter@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Thanks to Guy Streeter for letting me know about this problem.
Signed-off-by: Arnaldo Carvalho de Melo <acme@doppio.ghostprotocols.net>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
So that we don't require the tools that use p-l-procfs to call load_cmdline
everytime we refresh the list of processes, leaving parsing of /proc/cmdline to
the last possible moment.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Since we now defer looking at the contents till we really need to parse the
files, we have to check if the process died in this method.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Usage example:
>>> import procfs
>>> ps = procfs.pidstats()
>>> for t in ps.find_by_name("sirq-net-tx/6"):
... print "%s: %s" % (t, ps.process_flags(t))
...
85: ['PF_FORKNOEXEC', 'PF_NOFREEZE', 'PF_SUPERPRIV', 'PF_THREAD_BOUND']
>>> for t in ps.find_by_name("pdflush"):
... print "%s: %s" % (t, ps.process_flags(t))
...
398: ['PF_FLUSHER', 'PF_FORKNOEXEC', 'PF_SWAPWRITE']
399: ['PF_FLUSHER', 'PF_FORKNOEXEC', 'PF_SWAPWRITE']
>>>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
To build an rpm without first commiting the latest changes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Thanks to Jon Masters for pointing out this.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
So that we can experiment with files saved from different machines.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Number of cpus remains with the same algorithms, so for a 16 socket
machine with dual core cpus with ht enabled we have:
nr_sockets: 16
nr_cores: 32
nr_cpus: 64
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|
|
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
|