Bug 203291 - Sort filtered pids
Summary: Sort filtered pids
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Trace-cmd/Kernelshark (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Default virtual assignee for Trace-cmd and kernelshark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-12 18:48 UTC by Steven Rostedt
Modified: 2019-06-07 06:31 UTC (History)
1 user (show)

See Also:
Kernel Version: N/A
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Steven Rostedt 2019-04-12 18:48:14 UTC
Phil Auld discovered that running trace-cmd on a machine that has a lot of CPUS (160 in his case), the filtering logic fails because it adds a filter to all events to not trace the recorder tasks, and we overrun the buffer.

https://lore.kernel.org/lkml/20190412135333.GB6201@pauld.bos.csb/T/#u

Having 160 items to check is a lot regardless. This can be done better by changing what gets written into the sorting algorithm to make it filter on ranges and not only individual pids.

If we have tasks with pids 100, 101, 102, 103, 104, 105, 106, instead of adding a filter making sure that the pid doesn't match each one, change it to see if the pids are not in a range of 100 through 106.

e.g. instead of

 (common_pid!=100)&&(common_pid!=101)&&(common_pid!=102)&&(common_pid!=103)&&(common_pid!=104)&&(common_pid!=105)&&(common_pid!=106)

write

 (!((common_pid>=100)&&(common_pid<=106)))

It will make the parsing in the kernel faster too.
Comment 1 Slavomir Kaslev 2019-06-07 06:31:32 UTC
Fixed in c437dbe791ac33f51c168cffc43024bef91b7055.

Note You need to log in before you can comment on or make changes to this bug.