Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp392734pxu; Tue, 1 Dec 2020 14:04:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTKa5Q27G+dEbCo00xH9fLTW8bVKFwZogIdNwTgzhyXxhYv6eIfFMYXs/qBJngWONd7WcP X-Received: by 2002:a05:6402:30ab:: with SMTP id df11mr5180028edb.361.1606860279181; Tue, 01 Dec 2020 14:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606860279; cv=none; d=google.com; s=arc-20160816; b=doFksYDriiUMJBGV1MM9ydDQrwsZq3e9TQR2ux2Nld2NYlrZjtk1flUDPtmalheYK0 ZC6iss4tU9bCj0k+y6puxMnSUKjaUZLN5mE9o4YZ5ViRqAcsBgQn7yYFKDwSNKntH2ID No1Ui7UgdbUZE6guVtNFbwkTuKXgof+dobuBzHeiD6AM4aL1Qpf72gZrsWAGPA7oO818 JQdUWkMdWM1806V66OsT52XfugYeHEYS5DrL+4i3NaBEbcpYI0SD63m0VzBCYY36DKPp rM/QuvCXHzCqEkXvPcgwRYxHs5UIkDZXludPCY5Z58APIbH4IYP9/wvlldoKtb8Ojwqa hDlw== 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=G+ilhH1tx/5hxFBaLwzDJESRtVOS3IB6NXpTL+0VEMw=; b=DhDYP23tXIRA/nd55Hi3g1Q7Ug5ev95xaTUcdfjQQCznKoI0RdDmxv5Xw9Qo55D26y J1gQxETyFrPaUiQ8X7zHcvAYuuiu1hiEJzsisy/FAz9QmgLogPsQ647tsPzpgWzaiIQ2 f9PjyN9Zv0kk+7251LwwdSc4W4CsV9q29Tkul7GIbwNvgMR8QH4m4ckFJit8uldnHZaX GH2tCJCOYiobJawyoxRq1kOZD1YTOGRvtxd+Uc80Cmpc69cIWoh5W7HMoc3y1kA0FP7E x1wfKo/CUZgWTgKVWeyNSHyIJK4u44J4/smH8tGEdDto15omQFUCLzlpu/1CCg7pO5Bl 7kAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=LKjd3Nvq; 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 b19si822583edn.334.2020.12.01.14.04.16; Tue, 01 Dec 2020 14:04:39 -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=LKjd3Nvq; 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 S2391703AbgLAWBg (ORCPT + 99 others); Tue, 1 Dec 2020 17:01:36 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:26680 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390397AbgLAV75 (ORCPT ); Tue, 1 Dec 2020 16:59:57 -0500 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.42/8.16.0.42) with SMTP id 0B1LnhbJ006717 for ; Tue, 1 Dec 2020 13:59:16 -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=G+ilhH1tx/5hxFBaLwzDJESRtVOS3IB6NXpTL+0VEMw=; b=LKjd3NvqsSzQBEWS6V7UyyzyJX4CMYyI7BhqcatjJ4b5YSODEBfnp7UeFeB1WTNOT0Ms lTNc5jS+f706Rtft5bLHsB9BAtgPRLaHCU5QkyfnZVY3slJdXmtHHZ8cmuAkVQV3HQ0L ZADn3EwCdX85mS+0T0+JwsqzgTa4lQDReuU= Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net with ESMTP id 355pr6kf7g-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2020 13:59:16 -0800 Received: from intmgw001.41.prn1.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c085:21d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 1 Dec 2020 13:59:11 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 9C6BB19702C6; Tue, 1 Dec 2020 13:59:06 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v9 20/34] bpf: eliminate rlimit-based memory accounting for cpumap maps Date: Tue, 1 Dec 2020 13:58:46 -0800 Message-ID: <20201201215900.3569844-21-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201201215900.3569844-1-guro@fb.com> References: <20201201215900.3569844-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-12-01_11:2020-11-30,2020-12-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 malwarescore=0 priorityscore=1501 suspectscore=38 spamscore=0 adultscore=0 clxscore=1015 mlxlogscore=916 lowpriorityscore=0 mlxscore=0 phishscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010131 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not use rlimit-based memory accounting for cpumap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/cpumap.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index 90b949666605..747313698178 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -84,8 +84,6 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *at= tr) u32 value_size =3D attr->value_size; struct bpf_cpu_map *cmap; int err =3D -ENOMEM; - u64 cost; - int ret; =20 if (!bpf_capable()) return ERR_PTR(-EPERM); @@ -109,26 +107,14 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr= *attr) goto free_cmap; } =20 - /* make sure page count doesn't overflow */ - cost =3D (u64) cmap->map.max_entries * sizeof(struct bpf_cpu_map_entry = *); - - /* Notice returns -EPERM on if map size is larger than memlock limit */ - ret =3D bpf_map_charge_init(&cmap->map.memory, cost); - if (ret) { - err =3D ret; - goto free_cmap; - } - /* Alloc array for possible remote "destination" CPUs */ cmap->cpu_map =3D bpf_map_area_alloc(cmap->map.max_entries * sizeof(struct bpf_cpu_map_entry *), cmap->map.numa_node); if (!cmap->cpu_map) - goto free_charge; + goto free_cmap; =20 return &cmap->map; -free_charge: - bpf_map_charge_finish(&cmap->map.memory); free_cmap: kfree(cmap); return ERR_PTR(err); --=20 2.26.2