From: Oleg Nesterov <oleg@redhat.com>
To: "qiwu.chen" <qiwuchen55@gmail.com>
Cc: corbet@lwn.net, mhocko@suse.com, jani.nikula@intel.com,
akpm@linux-foundation.org, brauner@kernel.org,
paulmck@kernel.org, linux-doc@vger.kernel.org,
"qiwu.chen" <qiwu.chen@transsion.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] panic: add option to dump task maps info in panic_print
Date: Sun, 22 Sep 2024 15:13:22 +0200 [thread overview]
Message-ID: <20240922131321.GC9426@redhat.com> (raw)
In-Reply-To: <20240922095504.7182-1-qiwu.chen@transsion.com>
On 09/22, qiwu.chen wrote:
>
> + for_each_vma(vmi, vma) {
> + struct file *file = vma->vm_file;
> + int flags = vma->vm_flags;
> + unsigned long long pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
> + struct anon_vma_name *anon_name = NULL;
> + struct mm_struct *mm = vma->vm_mm;
> + char buf[256] = {0};
> + const char *name = NULL;
> +
> + if (mm)
> + anon_name = anon_vma_name(vma);
> +
> + if (file) {
> + if (anon_name) {
> + snprintf(buf, sizeof(buf), "[anon_shmem:%s]", anon_name->name);
> + name = buf;
> + } else {
> + char *f_path = d_path(file_user_path(file), buf, sizeof(buf));
> +
> + name = IS_ERR(f_path) ? "?" : f_path;
> + }
> + goto print;
> + }
> +
> + if (vma->vm_ops && vma->vm_ops->name) {
> + name = vma->vm_ops->name(vma);
> + if (name)
> + goto print;
> + }
> +
> + name = arch_vma_name(vma);
> + if (!name) {
> + if (mm) {
> + if (vma_is_initial_heap(vma))
> + name = "[heap]";
> + else if (vma_is_initial_stack(vma))
> + name = "[stack]";
> + } else
> + name = "[vdso]";
> +
> + if (anon_name) {
> + snprintf(buf, sizeof(buf), "[anon:%s]", anon_name->name);
> + name = buf;
> + }
> + }
> +
Wouldn't it be better to export/reuse get_vma_name() rather than duplicate
its code ?
Oleg.
prev parent reply other threads:[~2024-09-22 13:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 9:55 [PATCH v3 1/2] panic: add option to dump task maps info in panic_print qiwu.chen
2024-09-22 9:55 ` [PATCH v3 2/2] exit: dump current pt_regs info on global init exit qiwu.chen
2024-09-22 12:54 ` Oleg Nesterov
2024-09-23 5:11 ` chenqiwu
2024-09-22 13:12 ` [PATCH v3 1/2] panic: add option to dump task maps info in panic_print Oleg Nesterov
2024-09-23 4:08 ` chenqiwu
2024-09-22 13:13 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240922131321.GC9426@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=jani.nikula@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=paulmck@kernel.org \
--cc=qiwu.chen@transsion.com \
--cc=qiwuchen55@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.