[Crash-utility] improve ps performance

Dave Anderson anderson at redhat.com
Fri Sep 5 16:01:49 UTC 2014


Upon a quick examination of the latest patchset posted, this will
break pre-compiled extension modules that walk through the task list:

--- a/crash-7.0.7/defs.h
+++ b/crash-7.0.7/defs.h
@@ -758,13 +758,23 @@ struct task_context {                     /* context stored for each task */
        int processor;
        ulong ptask;
        ulong mm_struct;
+       ulong tgid;
+       ulong tgid_task_context_index;
        struct task_context *tc_next;
 };

Because it is typically done like so:

     struct task_context *tc;

    tc = FIRST_CONTEXT();
    for (i = 0; i < RUNNING_TASKS(); i++, tc++) {
        ...

Because it's an array, it's not safe to just move the new fields to the
end of the data structure (as is the case with the program_context struct).

Just checking the extension modules that are posted on the
http://people.redhat.com/anderson web site, it would break 3 of them:

  $ grep RUNNING_TASKS *.c
  ksm.c:	for (i = 0; i < RUNNING_TASKS(); i++, tc++) {
  swap_usage.c:                for (i = 0; i < RUNNING_TASKS(); i++, tc++) {
  trace.c:        for (i = 0; i < RUNNING_TASKS(); i++)
  trace.c:	for (i = 0; i < RUNNING_TASKS(); i++)
  $

I haven't studied how this patchset works, but I wonder whether this
could be avoided?

It's not a set-in-stone rule that these kind of changes can never be
made.  But on the other hand, I don't believe that structure has ever
been changed -- because anything about a task can be determined
directly or indirectly from its contents.

Dave

----- Original Message -----
> 
> 
> 
> 
> 
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list