[Crash-utility] About displaying virtual memory information of exiting task
Dave Anderson
anderson at redhat.com
Tue Dec 2 14:00:39 UTC 2014
----- Original Message -----
> Hello Dave,
>
> I'd like to discuss about the following feature with you and get some advise.
>
> vm command is used to display virtual memory information of a task. But if the
> task is exiting(according to crash, 'tsk->flags & PF_EXITING' is true), vm will
> set mm to 0 in get_task_mem_usage(). But the mm may be not freed yet, the mm and
> its related virtual information is helpful when debuging a exiting task.
But it may have been freed, and in the case of CONFIG_SLUB, the mm_struct.mmap member
would be overwritten as a free slab object link pointer, making it useless. Or it
could have been freed-and-reused.
>
> I was considering to ignore the IS_EXITING(task) in get_task_mem_usage() and
> if tsk->mm is set to NULL but the mm is not freed(see the following case), then we
> can specify the mm manually.
>
> CASE(the code is from kernel):
> <cut>
> exit_mm()
> {
> ...
> tsk->mm = NULL; --> dump after this, and before mmput() freeing mm
> ...
> mmput(mm);
> }
> <cut>
>
> But I guess it is not a good design to you. So I reconsidered it. What about specifying
> mm to vm just like task's pid or address. Then vm can retrieve virtual memory information
> from specified mm directly. And get the owner task from mm->owner.
That might work, at least if:
(1) the mm_struct has not been freed (SLUB),
(2) the mm_struct has not been freed-and-reused, and
(3) the kernel is configured with CONFIG_MEMCG and mm->owner points to the exiting task.
But how would a typical user of this option know what the mm_struct address is?
Dave
More information about the Crash-utility
mailing list