From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Amery Hung <ameryhung@gmail.com>
Cc: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>,
<alexei.starovoitov@gmail.com>, <andrii@kernel.org>,
<daniel@iogearbox.net>, <paul.chaignon@gmail.com>,
<kuba@kernel.org>, <stfomichev@gmail.com>,
<martin.lau@kernel.org>, <mohsin.bashr@gmail.com>,
<noren@nvidia.com>, <dtatulea@nvidia.com>, <saeedm@nvidia.com>,
<tariqt@nvidia.com>, <mbloch@nvidia.com>, <kernel-team@meta.com>
Subject: Re: [PATCH bpf-next v6 1/7] bpf: Clear pfmemalloc flag when freeing all fragments
Date: Mon, 22 Sep 2025 17:05:48 +0200 [thread overview]
Message-ID: <aNFlzBjGfG9A7RDa@boxer> (raw)
In-Reply-To: <20250919230952.3628709-2-ameryhung@gmail.com>
On Fri, Sep 19, 2025 at 04:09:46PM -0700, Amery Hung wrote:
> It is possible for bpf_xdp_adjust_tail() to free all fragments. The
> kfunc currently clears the XDP_FLAGS_HAS_FRAGS bit, but not
> XDP_FLAGS_FRAGS_PF_MEMALLOC. So far, this has not caused a issue when
> building sk_buff from xdp_buff since all readers of xdp_buff->flags
> use the flag only when there are fragments. Clear the
> XDP_FLAGS_FRAGS_PF_MEMALLOC bit as well to make the flags correct.
>
> Signed-off-by: Amery Hung <ameryhung@gmail.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> include/net/xdp.h | 5 +++++
> net/core/filter.c | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/include/net/xdp.h b/include/net/xdp.h
> index b40f1f96cb11..f288c348a6c1 100644
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
> @@ -115,6 +115,11 @@ static __always_inline void xdp_buff_set_frag_pfmemalloc(struct xdp_buff *xdp)
> xdp->flags |= XDP_FLAGS_FRAGS_PF_MEMALLOC;
> }
>
> +static __always_inline void xdp_buff_clear_frag_pfmemalloc(struct xdp_buff *xdp)
> +{
> + xdp->flags &= ~XDP_FLAGS_FRAGS_PF_MEMALLOC;
> +}
> +
> static __always_inline void
> xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq)
> {
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 63f3baee2daf..5837534f4352 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4210,6 +4210,7 @@ static int bpf_xdp_frags_shrink_tail(struct xdp_buff *xdp, int offset)
>
> if (unlikely(!sinfo->nr_frags)) {
> xdp_buff_clear_frags_flag(xdp);
> + xdp_buff_clear_frag_pfmemalloc(xdp);
> xdp->data_end -= offset;
> }
>
> --
> 2.47.3
>
next prev parent reply other threads:[~2025-09-22 15:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 23:09 [PATCH bpf-next v6 0/7] Add kfunc bpf_xdp_pull_data Amery Hung
2025-09-19 23:09 ` [PATCH bpf-next v6 1/7] bpf: Clear pfmemalloc flag when freeing all fragments Amery Hung
2025-09-22 15:05 ` Maciej Fijalkowski [this message]
2025-09-19 23:09 ` [PATCH bpf-next v6 2/7] bpf: Allow bpf_xdp_shrink_data to shrink a frag from head and tail Amery Hung
2025-09-22 15:09 ` Maciej Fijalkowski
2025-09-19 23:09 ` [PATCH bpf-next v6 3/7] bpf: Support pulling non-linear xdp data Amery Hung
2025-09-19 23:09 ` [PATCH bpf-next v6 4/7] bpf: Clear packet pointers after changing packet data in kfuncs Amery Hung
2025-09-19 23:09 ` [PATCH bpf-next v6 5/7] bpf: Support specifying linear xdp packet data size for BPF_PROG_TEST_RUN Amery Hung
2025-09-22 19:20 ` Martin KaFai Lau
2025-09-22 19:48 ` Amery Hung
2025-09-22 20:04 ` Martin KaFai Lau
2025-09-22 22:30 ` Amery Hung
2025-09-19 23:09 ` [PATCH bpf-next v6 6/7] selftests/bpf: Test bpf_xdp_pull_data Amery Hung
2025-09-19 23:09 ` [PATCH bpf-next v6 7/7] selftests: drv-net: Pull data before parsing headers Amery Hung
2025-09-22 15:05 ` [PATCH bpf-next v6 0/7] Add kfunc bpf_xdp_pull_data Maciej Fijalkowski
2025-09-22 17:46 ` Amery Hung
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=aNFlzBjGfG9A7RDa@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dtatulea@nvidia.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=martin.lau@kernel.org \
--cc=mbloch@nvidia.com \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=paul.chaignon@gmail.com \
--cc=saeedm@nvidia.com \
--cc=stfomichev@gmail.com \
--cc=tariqt@nvidia.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 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.