Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp69570pxu; Tue, 24 Nov 2020 19:06:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxo0s3Ajf0ytiYTyZqQ5ABf6o8jfCXt1MloZ+SKY6QnwXwyoOXtjT+/QP+87vjor4daKSI4 X-Received: by 2002:a17:906:b80e:: with SMTP id dv14mr1275045ejb.528.1606273564497; Tue, 24 Nov 2020 19:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606273564; cv=none; d=google.com; s=arc-20160816; b=ifHMjOJg+V/X2kasswI9kCKxzRpZ3wbMsvqdk5Z3A1mY8BwrXTmqFGD70lxfUiGWUI DegPwCpkhMnVVH7sivK07S6qqO35zhAyCDQxBnSxxMJ+X+x7WMvzOQAmhFeAXrA2Jdxt C1avcc3qzQMr5vTN/E9v3Gch21i+HJB+pHKrT2j0XOEkxAxnlwVsdYpwWVT9Uk6Mdqx+ OTe7VejJWSCs6nUSB7njqDzfWWXn1CX7Y4ZY0W/4JYyDOJH8EyvZB1o3riEbk1mfkTuz Fpa75ouBkHsXn5ozYy2cxbdCp9kO8xTjAjw67WjcQ8N1WlXvbj/MxHMo7Skx7Pt3lh8a DX+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RH10uTc2SABI5+AuWBz8rVMMslGuSfje99oYC4biZTk=; b=qcQwdRkiRJtKSM1iQpF0ygAgi3ISfHvTtu2SGyz01brb6qaiu3iZ1qqsTGG7/8Ie1C gD099QaVBFdtXtxB8XsHgGDUrVfI9Cfcv0xMbdpWFCWyubkUvyUxG5jXFeQQ5dZGcHTI izqCkxLed1uKnK9tH4hZ/cnokiQlzvYCQ4RMfO8t8SEYJAWkPZSIhu/ppd73mf5fqJpV BhNdqiyl57nHC5l54Dzz4ZZf3gJjMIPY1Yv9UJzPZHRrlqqswn8KIfo2VTAoD+pSHWUb MNnAgcUf7fH8V0u3rEvpDhIEiBZhlr8s8n+A4jiJ10O5DtAxlJ5l1l3moA/K+Y6ar6JS bMMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=kkPXcfNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq5si416626edb.542.2020.11.24.19.05.41; Tue, 24 Nov 2020 19:06:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=kkPXcfNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727437AbgKYDBc (ORCPT + 99 others); Tue, 24 Nov 2020 22:01:32 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:15098 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727364AbgKYDBa (ORCPT ); Tue, 24 Nov 2020 22:01:30 -0500 Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AP30VsV002315 for ; Tue, 24 Nov 2020 19:01:29 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=RH10uTc2SABI5+AuWBz8rVMMslGuSfje99oYC4biZTk=; b=kkPXcfNnOh9u2ltCtGQJrhSWzLQlD2awXeYK6BoI1tO+2YDsM0d13LcksD4hRPixhrEO jdGx4YLqD8aJ+OjmLtkAFrnMXAU5UVV+0NKeKeD+iq23wSaeYBNBuAEoFI1MaTNeRVqf /s31ixMoc6Dr01+WVG/4RtSAi2QO4wbVYQk= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34yk904r0x-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 24 Nov 2020 19:01:29 -0800 Received: from intmgw001.41.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 24 Nov 2020 19:01:26 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 257C516A189B; Tue, 24 Nov 2020 19:01:22 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v8 13/34] bpf: memcg-based memory accounting for lpm_trie maps Date: Tue, 24 Nov 2020 19:00:58 -0800 Message-ID: <20201125030119.2864302-14-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201125030119.2864302-1-guro@fb.com> References: <20201125030119.2864302-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-24_11:2020-11-24,2020-11-24 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 suspectscore=13 malwarescore=0 mlxlogscore=777 spamscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011250019 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Include lpm trie and lpm trie node objects into the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index 00e32f2ec3e6..a7d1e5cb80da 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf/lpm_trie.c @@ -282,8 +282,9 @@ static struct lpm_trie_node *lpm_trie_node_alloc(cons= t struct lpm_trie *trie, if (value) size +=3D trie->map.value_size; =20 - node =3D kmalloc_node(size, GFP_ATOMIC | __GFP_NOWARN, - trie->map.numa_node); + node =3D bpf_map_kmalloc_node(&trie->map, size, + GFP_ATOMIC | __GFP_NOWARN | __GFP_ACCOUNT, + trie->map.numa_node); if (!node) return NULL; =20 @@ -557,7 +558,7 @@ static struct bpf_map *trie_alloc(union bpf_attr *att= r) attr->value_size > LPM_VAL_SIZE_MAX) return ERR_PTR(-EINVAL); =20 - trie =3D kzalloc(sizeof(*trie), GFP_USER | __GFP_NOWARN); + trie =3D kzalloc(sizeof(*trie), GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT= ); if (!trie) return ERR_PTR(-ENOMEM); =20 --=20 2.26.2