[Crash-utility] [PATCH v3 0/1] Filter ps output by scheduling policy
Dave Anderson
anderson at redhat.com
Tue Oct 24 19:26:59 UTC 2017
Hi Oleksandr,
I finally got around to doing a code review today, and ended up making a few
minor changes to your patch:
(1) Instead of defaulting to NORMAL, invalid arguments generate a FATAL
error.
(2) I reworded the help page entry, and moved it up into the restricted
process section instead of down in the "alternatives" section.
(3) I moved the offset_table[] and size_table[] task_struct_policy members
to the end of the arrays to prevent any breakage of pre-compiled
extension modules.
(4) Display the task_struct_policy offset and size table values in the
dump_offset_table() function for "help -o".
(5) Replaced the strdup() call with STRDUPBUF(), calloc() with GETBUF(),
and free() calls with FREEBUF() to avoid using them during runtime.
But I need you to re-work your sched_policy_bit_from_str() function so that it
will accept a hexadecimal number, i.e, "ps -y 0x2". Granted it's not explicitly
allowed in the help page, but a user may see the policy expressed as a hexadecimal
value by "task" or "struct", and it seems too picky to just disallow it.
I've attached an updated version of the patch with the changes above.
Thanks,
Dave
----- Original Message -----
> While analyzing vmcores from customers sometimes we want
> to filter tasks by scheduling policy, for instance, to identify
> if customer runs realtime tasks. Doing this via foreach grepping
> and then feeding back pointers to task_struct and grepping it again
> is very slow, especially if customer runs thousands of tasks.
>
> So, let's add another option for ps to filter tasks by scheduling
> policy.
>
> Changes in v3:
>
> * fix snprintf format specifier for ulong
> * fix snprintf block indentation
> * add one more comma to help output
>
> Changes in v2:
>
> * handle task_struct.policy member size correctly
> * accept comma-separated list of policies
> instead of requiring multiple -y arguments
> * policy can be specified as a number too
> * policy name is case-insensitive now
> * warn about incorrect policy name
> * fix help message formatting
> * mark upper_case() source string pointer as a const
> (minor cleanup)
>
> Oleksandr Natalenko (1):
> task: also filter ps output by ->policy
>
> defs.h | 15 +++++++-
> help.c | 7 +++-
> task.c | 135
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
> tools.c | 5 ++-
> 4 files changed, 152 insertions(+), 10 deletions(-)
>
> --
> 2.14.2
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ps-y.patch
Type: text/x-patch
Size: 11631 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20171024/c74d1856/attachment.bin>
More information about the Crash-utility
mailing list