[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQJNQ+9D+3y-jLh3KVczcSo_Piz2O9-V9Grh3c1NQZujsA@mail.gmail.com>
Date: Tue, 22 Aug 2023 14:19:15 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Chris Li <chrisl@...nel.org>
Cc: Kemeng Shi <shikemeng@...weicloud.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Andrew Morton <akpm@...ux-foundation.org>,
baolin.wang@...ux.alibaba.com, Michal Hocko <mhocko@...e.com>,
David Hildenbrand <david@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
linux-mm <linux-mm@...ck.org>,
Namhyung Kim <namhyung@...gle.com>,
Greg Thelen <gthelen@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
John Sperbeck <jsperbeck@...gle.com>,
Huang Ying <ying.huang@...el.com>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard
On Tue, Aug 22, 2023 at 2:15 PM Chris Li <chrisl@...nel.org> wrote:
>
> Hi Kemeng,
>
> On Mon, Aug 21, 2023 at 6:27 PM Kemeng Shi <shikemeng@...weicloud.com> wrote:
> > >
> > Agreed. We assume pcp->count is protected by pcp->lock. Instead of make code
> > work in case pcp->count could be changed without lock held, it's more reasonble
> > to modify pcp->count with pcp->lock held in BPF program.
>
> The lock is holded when pcp->count is modified. It is going through
> the kernel page
> allocation API. The issue is nest memory allocation inside spin_lock()
> introduced by BPF.
>
> 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.
Can you reproduce the issue on the latest upstream kernel?
Powered by blists - more mailing lists