Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2244653ybg; Thu, 30 Jul 2020 14:28:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnjXlaUXkWdtZI3IjysBeWDJ9DjRb9CDGAFn8XeJ149rwMvQ4LTHZDoBHsBY5jvnbpGduz X-Received: by 2002:aa7:c6c2:: with SMTP id b2mr985342eds.173.1596144513173; Thu, 30 Jul 2020 14:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596144513; cv=none; d=google.com; s=arc-20160816; b=MKNokxR60LuTnZRti355wqj8QOQBGCIUIkCkTn7ZBxE6G2I5S4KCNKa0mFv3fjNPVZ 6Q6mNWJtqofuqfRZ8nfLe1HNtQ00qxKcvfVlQHLPOCNZwBlb5S0q1Ls8HG2o03vBb0d3 7XSCoKBzuqpTm4K8M1XO2Z2FNf2yjbRKEAnkxU67xOIrEBJBnWdsqSo68T67FtdlhPSz dUYzwlT8qvBwyCRQPwkEAB+2m9okLFnvDBwAsSe2/gPE1iFbBmOWLk1iSd91DDnZKhcZ JpOEEWdkv5IQxhMp5ODlHVLCBN1ADIrpPYlWTcFFTWtJT1ARrv2v399glpC94aSJeiLw wc3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:smtp-origin-cluster :cc:to:smtp-origin-hostname:from:smtp-origin-hostprefix :dkim-signature; bh=aJhxUwc8CQWldWv2VHn/REvyN245rZYwC4rTdQ9c38E=; b=u0V5e+AmE9V6lFtHmNydaWh+FrkNJHB0bX1X1Iz6gu2L0vqf4FuGzh5LdXL4WGrf5a ujk1YvehqCMUQpIKvu3zJlQLWMKtyOml2gxHcfLTrjtMT8Y5MvwPQbrzHjnMpWUmV1tP Omk5TCVndhKqN7vbk6JCOb/21E7fqbpzOA3lK/DMN82ds7XHtQhm9Q2h2H5/fGUuEjVh 1KyN8h7iEiCIuW2cgpPam0utHqrj4HkPApIFV+lSkZUHfvwAw5zwmb1CIO8Ysi8r4wh9 4WwRrxhEMVEfiASz55UUJZ5FtN7cQDAHik9oi6MphfTpnN/s5TfMlMVHShBtu+hqAhyv jKWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=VEzzoM4o; 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 z11si3777932ejo.189.2020.07.30.14.28.11; Thu, 30 Jul 2020 14:28:33 -0700 (PDT) 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=VEzzoM4o; 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 S1730798AbgG3VZM (ORCPT + 99 others); Thu, 30 Jul 2020 17:25:12 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:6894 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730712AbgG3VXX (ORCPT ); Thu, 30 Jul 2020 17:23:23 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.42/8.16.0.42) with SMTP id 06ULDviX014824 for ; Thu, 30 Jul 2020 14:23:22 -0700 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=aJhxUwc8CQWldWv2VHn/REvyN245rZYwC4rTdQ9c38E=; b=VEzzoM4ovnJBIpbgBfrXZILoUeIvg04oavUBqDeskupzb5O8emAzjZaEetaNCMg3Y4/q HOZL7ay+cgwNxDmRjbogMrbFOL9bUlALlyKsJ+XGvCh8W6vJ+34q7FfXkzSDzaE8v7EG uPnq/VzQQ6IM7UnhxZpr623hh5Erc2QDMH0= Received: from maileast.thefacebook.com ([163.114.130.16]) by m0001303.ppops.net with ESMTP id 32m0b1j4c9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2020 14:23:21 -0700 Received: from intmgw003.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 30 Jul 2020 14:23:21 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id D2AAE20B00B8; Thu, 30 Jul 2020 14:23:12 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm1096.prn0.facebook.com To: CC: , Alexei Starovoitov , Daniel Borkmann , , , Roman Gushchin , Song Liu Smtp-Origin-Cluster: prn0c01 Subject: [PATCH bpf-next v3 14/29] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps Date: Thu, 30 Jul 2020 14:22:55 -0700 Message-ID: <20200730212310.2609108-15-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200730212310.2609108-1-guro@fb.com> References: <20200730212310.2609108-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.235,18.0.687 definitions=2020-07-30_15:2020-07-30,2020-07-30 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 impostorscore=0 suspectscore=38 adultscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=989 malwarescore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007300150 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not use rlimit-based memory accounting for bpf_struct_ops maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/bpf_struct_ops.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index 969c5d47f81f..22bfa236683b 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -550,12 +550,10 @@ static int bpf_struct_ops_map_alloc_check(union bpf= _attr *attr) static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr) { const struct bpf_struct_ops *st_ops; - size_t map_total_size, st_map_size; + size_t st_map_size; struct bpf_struct_ops_map *st_map; const struct btf_type *t, *vt; - struct bpf_map_memory mem; struct bpf_map *map; - int err; =20 if (!bpf_capable()) return ERR_PTR(-EPERM); @@ -575,20 +573,11 @@ static struct bpf_map *bpf_struct_ops_map_alloc(uni= on bpf_attr *attr) * struct bpf_struct_ops_tcp_congestions_ops */ (vt->size - sizeof(struct bpf_struct_ops_value)); - map_total_size =3D st_map_size + - /* uvalue */ - sizeof(vt->size) + - /* struct bpf_progs **progs */ - btf_type_vlen(t) * sizeof(struct bpf_prog *); - err =3D bpf_map_charge_init(&mem, map_total_size); - if (err < 0) - return ERR_PTR(err); =20 st_map =3D bpf_map_area_alloc(st_map_size, NUMA_NO_NODE); - if (!st_map) { - bpf_map_charge_finish(&mem); + if (!st_map) return ERR_PTR(-ENOMEM); - } + st_map->st_ops =3D st_ops; map =3D &st_map->map; =20 @@ -599,14 +588,12 @@ static struct bpf_map *bpf_struct_ops_map_alloc(uni= on bpf_attr *attr) st_map->image =3D bpf_jit_alloc_exec(PAGE_SIZE); if (!st_map->uvalue || !st_map->progs || !st_map->image) { bpf_struct_ops_map_free(map); - bpf_map_charge_finish(&mem); return ERR_PTR(-ENOMEM); } =20 mutex_init(&st_map->lock); set_vm_flush_reset_perms(st_map->image); bpf_map_init_from_attr(map, attr); - bpf_map_charge_move(&map->memory, &mem); =20 return map; } --=20 2.26.2