[Crash-utility] [PATCH] task.c: avoid unnecessary cpu cycles during init

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Tue Nov 17 06:33:33 UTC 2020


-----Original Message-----
> 在 2020年11月17日 01:00, crash-utility-request at redhat.com 写道:
> >> While stkptr_to_task does the job of trying to match a stack pointer
> >> to a task, it runs through each task's stack to find whether the given
> >> SP falls into its range. This can be a very expensive operation, if
> >> the vmcore is from a system running too many tasks. It can get even
> >> worse when the total number of CPUs on the system is in the order of
> >> thousands. Given the expensive nature of the operation, it must be
> >> optimized as much as possible. Possible options to optimize:
> >>
> >>   1) Get min & max of the stack range in first pass and use these
> >>      values against the given SP to decide whether or not to proceed
> >>      with stack lookup.
> >>   2) Use multithreading to parallely update irq_tasks.
> >>   3) Skip stkptr_to_task() when SP is 0
> >>
> >> Though option 3 is a low hanging fruit, it significantly improved the
> >> time taken between starting crash utility & reaching crash prompt.
> >> Implement option 3 to optimize while listing the other two options
> >> as TODO items for follow-up.
> > It looks like on x86_64 the stkptr_to_task() is not called when starting
> > session and I cannot test, but the patch looks safe enough.
> >
> > Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>
> >
> > Lianbo, Bhupesh, this is not a fix but huge improvement for some
> > machines or situations, so I'd like to pick it up for crash-7.2.9.
> 
> Agree with you, this improvement looks good.

Thanks, applied.
https://github.com/crash-utility/crash/commit/46cfe1f5aed3b1950df505d71553c13abab060a6

Kazu

> 
> > Could you ack this? and my patch for the compiler warnings?
> >
> Yes. After applying your patch, it doesn't reproduce any more.
> 
> Good findings, Kazu.
> 
> Thanks.
> Lianbo
> 
> > Thanks,
> > Kazu
> >





More information about the Crash-utility mailing list