linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Chris Li <chrisl@kernel.org>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	 Andrew Morton <akpm@linux-foundation.org>,
	baolin.wang@linux.alibaba.com,  Michal Hocko <mhocko@suse.com>,
	David Hildenbrand <david@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	 linux-mm <linux-mm@kvack.org>,
	Namhyung Kim <namhyung@google.com>,
	 Greg Thelen <gthelen@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	 John Sperbeck <jsperbeck@google.com>,
	Huang Ying <ying.huang@intel.com>,
	 Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard
Date: Tue, 22 Aug 2023 14:35:58 -0700	[thread overview]
Message-ID: <CAADnVQK-xqJxqcfpje0fvBKADB-nd_hQFuyoMMwqajEVKBG7Ng@mail.gmail.com> (raw)
In-Reply-To: <CAF8kJuOT5cSQNqO6-gf=M+hFxb2-nHT1eZnEvqGYGGC8qHn39Q@mail.gmail.com>

On Tue, Aug 22, 2023 at 2:29 PM Chris Li <chrisl@kernel.org> wrote:
>
> On Tue, Aug 22, 2023 at 2:19 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> > >
> > > The execution sequence is like this:
> > >
> > >        count = min(pcp->count, count);
> > >
> > >         /* Ensure requested pindex is drained first. */
> > >         pindex = pindex - 1;
> > >         bpf_injected_spin_lock_irqsave {
> > >                  alloc_page();
> > >                  original spin_lock_irqsave(&zone->lock, flags) ;
> > >         }
> >
> > bpf doesn't call into alloc_page() or slab alloc or pcpu alloc from
> > tracing progs.
> > All memory is preallocated.
>
> Here is the other patch submission thread which have more detail of
> how to reproduce it:
> https://lore.kernel.org/linux-mm/20230817-free_pcppages_bulk-v1-1-c14574a9f80c@kernel.org/
>
> It is on older version of the kernel.

Please demonstrate the issue on the latest kernel.
It's an unnecessary time sink for everyone to review patches
targeting an issue in the old kernel.

> > Can you reproduce the issue on the latest upstream kernel?
>
> Hope, the fix on the BPF side went in as commit c66a36af7ba3a628.
> I am not aware of other cases.

That was a temporary workaround on perf side.
bpf task local storage was properly fixed later.

> It seems the consensus is so far is that we don't support BPF doing
> nested allocation on spin locks.
> That will implite any function called under the spinlocks as well.

We're still talking past each other. bpf uses preallocated memory.
It might look like bpf prog is allocating, but it's actually
not calling into slab.

> Do we care about adding more warnings on this kind of allocation at all?

bpf doesn't mess with mm state.
If you somehow managed to cause mm splat with bpf prog talk to bpf folks first.
It's a bug somewhere in bpf. Not with mm.


  reply	other threads:[~2023-08-22 21:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18  6:05 Chris Li
2023-08-18  6:05 ` [PATCH RFC 1/2] mm/page_alloc: safeguard free_pcppages_bulk Chris Li
2023-08-18  6:05 ` [PATCH RFC 2/2] mm/page_alloc: free_pcppages_bulk clean up Chris Li
2023-08-24  6:28   ` kernel test robot
2023-08-24 15:25     ` Chris Li
2023-08-21 10:32 ` [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard Mel Gorman
2023-08-22  1:27   ` Kemeng Shi
2023-08-22 21:14     ` Chris Li
2023-08-22 21:19       ` Alexei Starovoitov
2023-08-22 21:29         ` Chris Li
2023-08-22 21:35           ` Alexei Starovoitov [this message]
2023-08-22 21:46             ` Chris Li
2023-08-22 17:48   ` Chris Li
2023-08-22 18:28     ` Matthew Wilcox
2023-08-22 18:57     ` Alexei Starovoitov
2023-08-22 21:34       ` Chris Li
2023-08-22 21:37         ` Alexei Starovoitov

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=CAADnVQK-xqJxqcfpje0fvBKADB-nd_hQFuyoMMwqajEVKBG7Ng@mail.gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=gthelen@google.com \
    --cc=jsperbeck@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=namhyung@google.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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