From: Roman Gushchin <roman.gushchin@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Shakeel Butt <shakeelb@google.com>,
Yafang Shao <laoar.shao@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Quentin Monnet <quentin@isovalent.com>,
Hao Luo <haoluo@google.com>, bpf <bpf@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>, NeilBrown <neilb@suse.de>
Subject: Re: [PATCH bpf-next v3 1/2] bpf: Make non-preallocated allocation low priority
Date: Tue, 12 Jul 2022 19:12:38 -0700 [thread overview]
Message-ID: <Ys4qFt5IsHt1pdfZ@castle> (raw)
In-Reply-To: <CAADnVQJvxoteUZdnsoyMQ53Qx1bvyBz=ybQGrsWL9-4R=aasUw@mail.gmail.com>
On Tue, Jul 12, 2022 at 05:49:24PM -0700, Alexei Starovoitov wrote:
> On Mon, Jul 11, 2022 at 12:19 PM Shakeel Butt <shakeelb@google.com> wrote:
> >
> > On Sat, Jul 9, 2022 at 8:45 AM Yafang Shao <laoar.shao@gmail.com> wrote:
> > >
> > > GFP_ATOMIC doesn't cooperate well with memcg pressure so far, especially
> > > if we allocate too much GFP_ATOMIC memory. For example, when we set the
> > > memcg limit to limit a non-preallocated bpf memory, the GFP_ATOMIC can
> > > easily break the memcg limit by force charge. So it is very dangerous to
> > > use GFP_ATOMIC in non-preallocated case. One way to make it safe is to
> > > remove __GFP_HIGH from GFP_ATOMIC, IOW, use (__GFP_ATOMIC |
> > > __GFP_KSWAPD_RECLAIM) instead, then it will be limited if we allocate
> > > too much memory. There's a plan to completely remove __GFP_ATOMIC in the
> > > mm side[1], so let's use GFP_NOWAIT instead.
> > >
> > > We introduced BPF_F_NO_PREALLOC is because full map pre-allocation is
> > > too memory expensive for some cases. That means removing __GFP_HIGH
> > > doesn't break the rule of BPF_F_NO_PREALLOC, but has the same goal with
> > > it-avoiding issues caused by too much memory. So let's remove it.
> > >
> > > This fix can also apply to other run-time allocations, for example, the
> > > allocation in lpm trie, local storage and devmap. So let fix it
> > > consistently over the bpf code
> > >
> > > It also fixes a typo in the comment.
> > >
> > > [1]. https://lore.kernel.org/linux-mm/163712397076.13692.4727608274002939094@noble.neil.brown.name/
> > >
> > > Cc: Roman Gushchin <roman.gushchin@linux.dev>
> > > Cc: Shakeel Butt <shakeelb@google.com>
> > > Cc: NeilBrown <neilb@suse.de>
> > > Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> >
> > Reviewed-by: Shakeel Butt <shakeelb@google.com>
>
> Applied to bpf-next.
Looks like I'm a bit late to the party, but my ack still applies.
Thanks!
next prev parent reply other threads:[~2022-07-13 2:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 15:44 [PATCH bpf-next v3 0/2] bpf: Minor fixes for non-preallocated memory Yafang Shao
2022-07-09 15:44 ` [PATCH bpf-next v3 1/2] bpf: Make non-preallocated allocation low priority Yafang Shao
2022-07-11 19:19 ` Shakeel Butt
2022-07-13 0:49 ` Alexei Starovoitov
2022-07-13 2:12 ` Roman Gushchin [this message]
2022-07-09 15:44 ` [PATCH bpf-next v3 2/2] bpf: Warn on non-preallocated case for missed trace types Yafang Shao
2022-07-10 17:51 ` Yonghong Song
2022-07-11 6:48 ` Yafang Shao
2022-07-11 19:04 ` Yonghong Song
2022-07-12 8:26 ` Yafang Shao
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=Ys4qFt5IsHt1pdfZ@castle \
--to=roman.gushchin@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.org \
--cc=neilb@suse.de \
--cc=quentin@isovalent.com \
--cc=shakeelb@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).