All of lore.kernel.org
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@meta.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Song Liu <songliubraving@meta.com>,
	Hugh Dickins <hughd@google.com>, Song Liu <song@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	David Stevens <stevensd@chromium.org>,
	Linux-MM <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Xu <peterx@redhat.com>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	Yang Shi <shy828301@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	Jiaqi Yan <jiaqiyan@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] mm/khugepaged: maintain page cache uptodate flag
Date: Wed, 29 Mar 2023 16:53:58 +0000	[thread overview]
Message-ID: <E1A7D23D-EFCB-482F-9D9D-F8D92F1630D2@fb.com> (raw)
In-Reply-To: <ZB2mH/XMj3vh1RrN@casper.infradead.org>



> On Mar 24, 2023, at 6:31 AM, Matthew Wilcox <willy@infradead.org> wrote:
> 
> On Fri, Mar 24, 2023 at 06:03:37AM +0000, Song Liu wrote:
>> 
>> 
>>> On Mar 23, 2023, at 8:30 PM, Matthew Wilcox <willy@infradead.org> wrote:
>> 
>> [...]
>> 
>>> 
>>> The Uptodate flag check needs to be done by the caller; the
>>> find_get_page() family return !uptodate pages.
>>> 
>>> But find_get_page() does not advertise itself as NMI-safe.  And I
>>> think it's wrong to try to make it NMI-safe.  Most of the kernel is
>>> not NMI-safe.  I think it's incumbent on the BPF people to get the
>>> information they need ahead of taking the NMI.  NMI handlers are not
>>> supposed to be doing a huge amount of work!  I don't really understand
>>> why it needs to do work in NMI context; surely it can note the location of
>>> the fault and queue work to be done later (eg on irq-enable, task-switch
>>> or return-to-user)
>> 
>> The use case here is a profiler (similar to perf-record). Parsing the 
>> build id in side the NMI makes the profiler a lot simpler. Otherwise, 
>> we will need some post processing for each sample. 
> 
> Simpler for you, maybe.  But this is an NMI!  It's not supposed to
> be doing printf-formatting or whatever, much less poking around
> in the file cache.  Like perf, it should record a sample and then
> convert that later.  Maybe it can defer to a tasklet, but i think
> scheduling work is a better option.
> 
>> OTOH, it is totally fine if build_id_parse() fails some time, say < 5%. 
>> The profiler output is still useful in such cases. 
>> 
>> I guess the next step is to replace find_get_page() with a NMI-safe
>> version?
> 
> No, absolutely not.  Stop doing so much work in an NMI.

While I understand the concern, it is not something we can easily remove, 
as there are users rely on this feature. How about we discuss this at
upcoming LSFMMBPF?

Thanks,
Song


  reply	other threads:[~2023-03-29 16:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  5:20 [PATCH v5 0/3] mm/khugepaged: fix khugepaged+shmem races David Stevens
2023-03-07  5:20 ` [PATCH v5 1/3] mm/khugepaged: refactor collapse_file control flow David Stevens
2023-03-23 19:51   ` Hugh Dickins
2023-03-07  5:20 ` [PATCH v5 2/3] mm/khugepaged: skip shmem with userfaultfd David Stevens
2023-03-23 19:48   ` Hugh Dickins
2023-03-24  5:34     ` David Stevens
2023-03-28 15:48       ` Peter Xu
2023-03-07  5:20 ` [PATCH v5 3/3] mm/khugepaged: maintain page cache uptodate flag David Stevens
2023-03-23 19:07   ` Hugh Dickins
2023-03-23 21:56     ` Matthew Wilcox
2023-03-23 22:28       ` Song Liu
2023-03-24  1:56         ` Hugh Dickins
2023-03-24  3:30           ` Matthew Wilcox
2023-03-24  6:03             ` Song Liu
2023-03-24 13:31               ` Matthew Wilcox
2023-03-29 16:53                 ` Song Liu [this message]
2023-03-28  9:48     ` David Stevens

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=E1A7D23D-EFCB-482F-9D9D-F8D92F1630D2@fb.com \
    --to=songliubraving@meta.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jiaqiyan@google.com \
    --cc=jolsa@kernel.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=shy828301@gmail.com \
    --cc=song@kernel.org \
    --cc=stevensd@chromium.org \
    --cc=willy@infradead.org \
    /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.