lkml.org 
[lkml]   [2023]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH RFC 0/2] mm/page_alloc: free_pcppages_bulk safeguard
Hi Kemeng,

On Mon, Aug 21, 2023 at 6:27 PM Kemeng Shi <shikemeng@huaweicloud.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) ;
}

Chris





Chris

\
 
 \ /
  Last update: 2023-08-22 23:16    [W:0.131 / U:2.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site