From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vasily Averin Subject: [PATCH v2 2/8] memcg: accounting for ip6_dst_cache Date: Mon, 15 Mar 2021 15:23:09 +0300 Message-ID: <8196f732-718e-0465-a39c-62668cc12c2b@virtuozzo.com> References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V/7TzPxZL+BSxMV4OSMz0uuVRjCbejTr7FbJogY4760=; b=CnNukf3/nISHyDI02EDWemSP8axhCQjNhvipVhkqiUSr3ddp3xOZ5qTP+Faw4vQgD1rPnMZWCzvMBJ6tDfqqFyPo+hbLKuOIp7qwQgsQwgtLO6HaRPZkOthoxGIUzJGD5iM5PIgp1nFMuXYA09+dUoxOM/2SS9yVrJFbL5GjvGU= In-Reply-To: Content-Language: en-US List-ID: Content-Type: text/plain; charset="us-ascii" To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Hocko Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Johannes Weiner , Vladimir Davydov , Shakeel Butt , "David S. Miller" , Hideaki YOSHIFUJI , Jakub Kicinski , David Ahern An untrusted netadmin inside a memcg-limited container can create a huge number of routing entries. Currently, allocated kernel objects are not accounted to proper memcg, so this can lead to global memory shortage on the host and cause lot of OOM kiils. This patches enables accounting for 'struct rt6_info' allocations. --- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1536f49..d1d7cdf 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -6526,7 +6526,7 @@ int __init ip6_route_init(void) ret = -ENOMEM; ip6_dst_ops_template.kmem_cachep = kmem_cache_create("ip6_dst_cache", sizeof(struct rt6_info), 0, - SLAB_HWCACHE_ALIGN, NULL); + SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, NULL); if (!ip6_dst_ops_template.kmem_cachep) goto out; -- 1.8.3.1