linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zach O'Keefe <zokeefe@google.com>
To: Gautam Menghani <gautammenghani201@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	rostedt@goodmis.org, mhiramat@kernel.org, shy828301@gmail.com,
	vbabka@suse.cz, david@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH v2] mm/khugepaged: add tracepoint to collapse_file()
Date: Tue, 25 Oct 2022 11:20:40 -0700	[thread overview]
Message-ID: <Y1go+BSdpGELmIZS@google.com> (raw)
In-Reply-To: <Y1duhy5kbhLoMqWO@biggie>

On Oct 25 10:35, Gautam Menghani wrote:
> On Mon, Oct 24, 2022 at 01:17:06PM -0700, Andrew Morton wrote:
> > On Mon, 24 Oct 2022 23:05:58 +0530 Gautam Menghani <gautammenghani201@gmail.com> wrote:
> > 
> > > In the file mm/khugepaged.c, a TODO in the function collapse_file() asks
> > > to add tracepoints. Add the tracepoint named "mm_khugepaged_collapse_file".
> > 
> > This isn't a very satisfying explanation for changing the kernel.  Maybe
> > the comment is stale are this tracepoint is unneeded.
> > 
> > Please explain afresh how this addition benefits kernel users?
> > 
> The function collapse_file() is called by the function hpage_collapse_scan_file(). 
> Without a tracepoint in collapse_file(), we won't know if it was called or not and as a result,
> we also won't know if it returned successfully or not. Also, as Zach mentioned earlier [1]:
> 
> there are a few scan result codes that overlap between hpage_collapse_scan_file() and those
> possibly returned in collapse_file() such that, if we only have the one tracepoint in 
> hpage_collapse_scan_file(), it could be ambiguous what callsite the error path stemmed from.
> 
> [1]:https://lore.kernel.org/lkml/CAAa6QmSKtj6T2dW1tkg5_HVj2+rXj5inOLdEzr0MkJzQxxcPXQ@mail.gmail.com/
> 
> Please do let me know if a v3 is needed.
> 
> Thanks,
> Gautam

Thanks Guatam,

The ambiguous codes in particular are:

SCAN_PTE_MAPPED_HUGEPAGE
SCAN_PAGE_COMPOUND
SCAN_PAGE_COUNT

; properties of a page that are checked before/after the page is
locked/isolated.  This personally hasn't been an issue for me, as someone who's
spent considerable time in these codepaths over the last little while.  There
are certainly other codes (like SCAN_FAIL) which are ambiguous within functions
(and likewise haven't been an issue) so this reason alone isn't particularly
motivating.

However, some of the extra information (is_shmem, index), at times, would have
been useful if was already available -- but it was never enough of a pain to
force my hand to put this tracepoint in.

If the tracepoint is staying, then 2 nits:

CHECK: Alignment should match open parenthesis
#74: FILE: mm/khugepaged.c:2064:
+       trace_mm_khugepaged_collapse_file(mm, hpage, index, is_shmem,
+               addr, file, nr, result);

and, apply Steven's advice to trace_mm_khugepaged_scan_file() for consistency.

Thanks,
Zach

  reply	other threads:[~2022-10-25 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 17:35 [PATCH v2] mm/khugepaged: add tracepoint to collapse_file() Gautam Menghani
2022-10-24 20:17 ` Andrew Morton
2022-10-25  5:05   ` Gautam Menghani
2022-10-25 18:20     ` Zach O'Keefe [this message]
2022-10-26  4:53       ` 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=Y1go+BSdpGELmIZS@google.com \
    --to=zokeefe@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gautammenghani201@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shy828301@gmail.com \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).