From: Steven Rostedt <rostedt@goodmis.org>
To: Gautam Menghani <gautammenghani201@gmail.com>
Cc: akpm@linux-foundation.org, mhiramat@kernel.org,
zokeefe@google.com, shy828301@gmail.com, vbabka@suse.cz,
david@redhat.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/khugepaged: add tracepoint to collapse_file()
Date: Mon, 24 Oct 2022 11:16:21 -0400 [thread overview]
Message-ID: <20221024111621.3ba17e2c@gandalf.local.home> (raw)
In-Reply-To: <20221024150922.129814-1-gautammenghani201@gmail.com>
On Mon, 24 Oct 2022 20:39:22 +0530
Gautam Menghani <gautammenghani201@gmail.com> wrote:
> +TRACE_EVENT(mm_khugepaged_collapse_file,
> + TP_PROTO(struct mm_struct *mm, struct page *hpage,
> + unsigned long addr, const char *filename, int nr,
> + int result),
> + TP_ARGS(mm, hpage, addr, filename, nr, result),
> + TP_STRUCT__entry(
> + __field(struct mm_struct *, mm)
> + __field(unsigned long, hpfn)
> + __field(unsigned long, addr)
> + __string(filename, filename)
> + __field(int, nr)
> + __field(int, result)
> + ),
> +
> + TP_fast_assign(
> + __entry->mm = mm;
> + __entry->hpfn = hpage ? page_to_pfn(hpage) : -1;
> + __entry->addr = addr;
> + __assign_str(filename, filename);
> + __entry->nr = nr;
> + __entry->result = result;
> + ),
> +
> + TP_printk("mm=%p, hpage_pfn=0x%lx, addr=%ld, filename=%s, nr=%d, result=%s",
> + __entry->mm,
> + __entry->hpfn,
> + __entry->addr,
> + __get_str(filename),
> + __entry->nr,
> + __print_symbolic(__entry->result, SCAN_STATUS))
> +);
> +
> #endif /* __HUGE_MEMORY_H */
> #include <trace/define_trace.h>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 4734315f7940..14db90e2f2ec 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -2059,7 +2059,9 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
> mem_cgroup_uncharge(page_folio(hpage));
> put_page(hpage);
> }
> - /* TODO: tracepoints */
> +
> + trace_mm_khugepaged_collapse_file(mm, hpage, addr, file->f_path.dentry->d_iname,
I try to keep dereferences out of the calling path as much as possible
(adds to I$ at the call site).
Could you just pass in file, and then have:
__string(filename, file->f_path.dentry->d_iname)
[..]
__assign_string(filename, file->f_path.dentry->d_iname);
If you are paranoid, you can have the above also be:
file ? file->f_path.dentry ? file->f_path.dentry->d_iname : "(null)" : "(null)")
-- Steve
> + nr, result);
> return result;
next prev parent reply other threads:[~2022-10-24 15:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 15:09 Gautam Menghani
2022-10-24 15:16 ` Steven Rostedt [this message]
2022-10-24 16:44 ` Zach O'Keefe
2022-10-24 17:38 ` Gautam Menghani
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=20221024111621.3ba17e2c@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gautammenghani201@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhiramat@kernel.org \
--cc=shy828301@gmail.com \
--cc=vbabka@suse.cz \
--cc=zokeefe@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox