Article View: linux.kernel.netdev
Article #16469[PATCH net-next v5 4/8] vxlan: vnifilter: account per-VNI memory to memcg
From: Ali Firas
Date: Sat, 14 Nov 2026 22:14
Date: Sat, 14 Nov 2026 22:14
51 lines
13005 bytes
13005 bytes
vxlan_vni_alloc() allocates a struct vxlan_vni_node and a per-CPU stats
block for every VNI, both with plain GFP_KERNEL, so neither is charged
to the cgroup of the process that created the VNI. A netdevice's own
struct and its Tx/Rx queues are already GFP_KERNEL_ACCOUNT in
alloc_netdev_mqs() (commit c948f51c1654 ("memcg: enable accounting for
net_device and Tx/Rx queues")), so these per-VNI allocations are an
unaccounted part of a device that a cgroup can grow one VNI at a time.
Charge both to the caller's cgroup with GFP_KERNEL_ACCOUNT in
vxlan_vni_alloc(). __GFP_ACCOUNT only charges an allocation made from a
task in a non-root memcg, so the sole caller, which already handles a
NULL return, is unaffected outside a memcg.
The charge lands in the caller's memcg: adding VNIs from inside one
moves each node into the accounted slab and raises the cgroup's per-CPU
memory. This covers the node and its stats only; a VNI carrying a group
or remote also installs a default FDB entry, whose allocations are not
charged here; "vxlan: vnifilter: account the default FDB entry to memcg"
later in this series accounts them.
Signed-off-by: Ali Firas <alishmery18@gmail.com>
---
v5: name the FDB accounting patch by subject; after the reordering it
is no longer the next patch.
v4: reworded to cover the node and stats only; the c948f51c1654
reference narrowed to net_device and its Tx/Rx queues; rebased.
drivers/net/vxlan/vxlan_vnifilter.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c
index 127ed5b2a2eb..07aa641f16e8 100644
--- a/drivers/net/vxlan/vxlan_vnifilter.c
+++ b/drivers/net/vxlan/vxlan_vnifilter.c
@@ -826,10 +826,11 @@ static struct vxlan_vni_node *vxlan_vni_alloc(struct vxlan_dev *vxlan,
{
struct vxlan_vni_node *vninode;
- vninode = kzalloc_obj(*vninode);
+ vninode = kzalloc_obj(*vninode, GFP_KERNEL_ACCOUNT);
if (!vninode)
return NULL;
- vninode->stats = netdev_alloc_pcpu_stats(struct vxlan_vni_stats_pcpu);
+ vninode->stats = __netdev_alloc_pcpu_stats(struct vxlan_vni_stats_pcpu,
+ GFP_KERNEL_ACCOUNT);
if (!vninode->stats) {
kfree(vninode);
return NULL;
--
2.53.0
Technical Details
Message-ID:
<20261114221412.255825-5-alishmery18@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363480-linux-kernel-netdev=dewy.ruReferences:
<20261114221412.255825-1-alishmery18@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363480-linux-kernel-netdev=dewy.ru
From: alishmery18@gmail.com (Ali Firas)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v5 4/8] vxlan: vnifilter: account per-VNI memory to memcg
Date: Sun, 15 Nov 2026 01:14:08 +0300
Organization: Usenet Network
Message-ID: <20261114221412.255825-5-alishmery18@gmail.com>
References: <20261114221412.255825-1-alishmery18@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1675515"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:dmHH1a2ekkvOkrmhgqK2Q5iKoTk= sha256:g8vHUvI/kzluGuQXjD0/j7RM2dxhbSj4xEg9ey1XYkE=
sha1:Xg/T+FLiOnMYE1GLgvtW9aPiSGM= sha256:YxTCP5NW/Jmy/nDwiZKktl4VON0TH13EwKxT7UJYY/k=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 32D951148F9; Sun, 15 Nov 2026 01:16:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id JL8_yJBhm4eN;
Sun, 15 Nov 2026 01:16:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-363480-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 5F94ADFD59; Sun, 15 Nov 2026 01:16:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 375AA60E92F; Sat, 14 Nov 2026 22:16:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794694547;
b=1ppZ9cAXsC1BBfb+jOMgGoj48KJIMKfDvgiqXwj6nWx+QN26iUCmNQCnkPYHGYGzm5Sn
SHa1IX0SJtztM9zEF36bUlPnw2dfLC+SogV40IhoywwspQhA14x0cZPjcBNIvIZ3NPNdx
PDtLZxtAuyImT2QQMyS6VYjP4/OlRwbyaFvjDmSH9IQhYusBm1OTVjVKm+YbwEuuqHr7H
B2AuYZ2dg+NS/V68PKvlKqBbfyYCSeCnCtOfVnA2AZQfN6k6YZofTdU95QNMNOH/QWd1t
BrBxjw+fm9TSSwWaVL8SXxfI6u21p1zG5cff0RDsjHZDE+ijFhktO0zu8CUFv2+g2rg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794694547;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=psCKisTbpJp1WRpTRFiCgMrs5Tc48KteBL0XoQIn2kk=;
b=FpyX0IdccuRkFycYHEUDLduwlAnt753ei8ag+Q6cXcmnB9ikMCtNwEtRAqKfFB9GFOYL
kPRndr4Z6pgtm/vD2Xyy0tmtbI4RF8U5w1Dj2FE62ayFPxZvio/7lHjhgSPo9vPvXno9r
dSLDnD/oN5WYfe5TnAtzoSAmqTM3tHDTNKacyxScOYu1yeE4EnRI40u5dxdvBn/0gXtMU
mPv+S74c6TfXCIeItTqGJsQ+S7HvqCV3wmAvJmUzEPswNA09QU9sOjfZEu5A7Gk7mXcKI
WjNXHRgDhjKm7fJxwEFLsWvd5l4yMWQYT0FwNX38DF/6R0LlFXUN68vePwo3EZdrl0Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=H4X+qHoj;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D7DC60A261A;
Sat, 14 Nov 2026 22:15:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=H4X+qHoj
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794694546;
b=B4VblYlBm0mXiZofB2ZuKOwDZxHZgjbi+as14PMibEWO/RZBkvBaF9y5AFcFo3uXl+HO
oPk2kEtMRTRq8F4qqKomYZVV1OGQ600BdDi66Kraaf4cJ116XqiUnxBOYboxB6DOHJ7bl
3dLbGvhnPoMTaGjoQ3hbt14nIvytyecVWOqmxFq4id1VOKbAGyLiYEqG7i/MHxiiBYoAT
mGlqkoD3aBGgUbU4tm6nujGNl6+Y2xN/ILRgx8dIXm+Wc5hGFE1+rncMkhucCbnBZfejx
Z0fbN1f0rbl+JrZu1EGcHx8yiwYzX8F5ggCnwctrmeRb4paysIsy1JyuSW80WkKLFZQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794694546;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=psCKisTbpJp1WRpTRFiCgMrs5Tc48KteBL0XoQIn2kk=;
b=p9Ixl3mbwdJsrxtW15cJe0wdBwYPzwJkEb7QeYlcSFoC1tHLiJgZ5q/MUiItk8X5nHNd
xMH9K0pUWnmjjr+idLAUd+okt+hIKY/cNAjwt3RcEb6Sb1aHB1jRffQk6Go6xlQl9c2tl
tTCzNy+mda2m6pagmziZYvBlIzZnj9OUQV/5lsif/6fIM9AHuPmY4GVOfd5GCzLGltkb+
wNnOwoC1JQWZdFFGJAzEyNwYNYSRWPN+a9UKjY8gBuWMYwsE/Io47jS+xNihcTF/kUEII
SHYwmKQOjusWkGIyg5Mqkfa5RXNt+EEyJqnkUypXTA8QiaL8HEJLtkpGc0o7WZChY7g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=H4X+qHoj;
arc=none smtp.remote-ip=209.85.221.46
X-Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E371060A260F
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 22:15:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E371060A260F
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-49465892f7bso1881203f8f.1
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 14:15:45 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794694544; x=1795299344; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=psCKisTbpJp1WRpTRFiCgMrs5Tc48KteBL0XoQIn2kk=;
b=H4X+qHojpx1LYBhdEpFy045MEYW1a0DsOUuqj9IZciuzX2vxbU4HMPTPB/vI/QGdNQ
SUKKBY3GJ9lznikm2/qJVPbjf49w3pMTL/Px21cLCmvajf4PuwizmPJ/3AKfLyaAdWI1
AeSWdVdKtIOrPHAURT+zj5mDR5z8qLFRop6mixyWs28i+GYco4APZiDd1O2olKySZ3/V
hofz0o/vHP+oNT1OEILHosZYGRBibYJHy4Jxb39zExjFqFg7uk9enr4qPN85qNtQi6Mw
DtUO5su9K9uxFQOEI8rJ+uVj/XiS+s+xPtEtMxHqeMwIhF/0hb3sua2zXeSoh5gvUYx+
cUZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794694544; x=1795299344;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=psCKisTbpJp1WRpTRFiCgMrs5Tc48KteBL0XoQIn2kk=;
b=c/8CVL/LPvKpWyh2J2GEozujNtXtYeBXUD1cPR4u4A74HuRCNOZhm3K/2FbdrUuh1N
jEQ/lQeHsl0kQbQIg5A7NeJz6U2ejPSSQF1Cs4KfIGuuPF4QzMKuGApOxRvNY+2/twu3
noHtSC774x7C0biLJ99OKXMdcHKjl1UbK7QPXxJ8Egv/D+E645i39QMdRWcDePwH6PIx
rfrQxfcEtkgIyDwIBqBFL6c+yjC1LnsFWeWWLuhN6NbmaBn3MSsKPpZRkPNMPF4q8N0M
hl8Tbi7sMtODeYWSeEgz097vJS4mNbVZlSvZdc5NKBWdb6K+uW4/pmpbs1XiA6GNKIQl
9uHw==
X-Gm-Message-State: APuU4Z/XjrI/S/SGmfpgRE3rZqrR9EyzqmdV5jjqxiDUhhWjUATeYwRM
DwFMGquTYzJQ3YLsr9LdedDPvZKZcVtsQYSDsYuzbvVIf3sh5AZgH6AwvEo3NS+p4+4=
X-Gm-Gg: AYBFou3JayEv3dwWLaijgTygYvwc1ePw3U5/IZW5+BmPyf9Bj1Ng+eip1G6CbQjHRPD
vl3myvM/SQ8ULdfzI3wM0WvxXtUBiJrQryWzie/WiFHQTgRzF4nt/ZNmZWQRUuaf6wrZDafWMWu
yF4eBYSJspNOlTMIyGezBOwIhCzWxwtuUH2YVQJk+rKLIbz3zW4vBuFGYklr9heVfJnccrhDgVr
w8kT+kufu+xrL/wocD+p7uqmC1njHS+vICZde3ZPBkCwy0rNVuv3okD77jiyqElsDxgh8somEfA
9vCNQSfPcD4vzK5GcOr4NRdlpCSW0kTU4fhV/YqEcXI3VhJ3UK9J+l+utu0fs9izUBAx/kfceCC
jdwOJKH6onwvCq1LmPPvV5AaDtTYgLtrmnNIXxlSEwRK5u5gis/3F/oMa01llmfdLCjTE3osgFH
mxvalv3BybvatjbThg6wM7EP063iB6Wr3b7MuUQF8CiAp6nk/BNFDUNa/vvKlI4xApJysw0DX4v
06JQW/2ymgY/PD6mjmBGCd/EJPl/Eo0nckqCjtNHl6vSRCNMx+iHezm/Qaeuu193KMOvfDNNuM8
teesnLDXLAJMFZLypYoMx2DQ
X-Received: by 2002:a05:6000:24c8:b0:49c:9e8a:31b9 with SMTP id ffacd0b85a97d-49c9e8a3318mr13880612f8f.9.1794694544235;
Sat, 14 Nov 2026 14:15:44 -0800 (PST)
X-Received: from kali ([169.224.126.250])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49c5d223a29sm13514941f8f.8.2026.11.14.14.15.41
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 14 Nov 2026 14:15:43 -0800 (PST)
X-Cc: kuba@kernel.org,
pabeni@redhat.com,
davem@davemloft.net,
edumazet@kernel.org,
andrew+netdev@lunn.ch,
horms@kernel.org,
razor@blackwall.org,
roopa@nvidia.com,
kuniyu@google.com,
petrm@nvidia.com,
aroulin@nvidia.com,
shuah@kernel.org,
linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ali Firas <alishmery18@gmail.com>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261114221412.255825-1-alishmery18@gmail.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list