Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3574292pxb; Mon, 16 Nov 2020 19:48:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhJYabdxng0rJ18GVEvSLv5NKp8XzJJl9vTe+jtcTw0iK7PU30ZfBR6CXREA9bFWORg+VB X-Received: by 2002:a17:906:d8ce:: with SMTP id re14mr17043307ejb.275.1605584921681; Mon, 16 Nov 2020 19:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605584921; cv=none; d=google.com; s=arc-20160816; b=KJh+R0hlDtKogN9STgl1uMw0ugFmr935SljbYbNvnCdMkSXZfZai5ANrGtzvs3KuHj ziAmBCJEMpoCIHs3Jm9O4kUy7w2PkJ/Ho2oSwLg+u7DXG7KmVj9J3wWm4j7s1C3Ulj9M uaUwHsvXW/3a1EUtLglc/YkVL6auwoC7PKOi9WcnNxc/uJEAwufge+5mNXDAS5V4KZlq uSytG+H2POzoxiN4rwQV3FfNbQeqZpanMhaVbFJitSFXaEeUCAxuzXw9Ecg04zVOIaFl XdahlRBNwnU3BzRKeFNueKbs4B274JOFTwWS0ZoZxRWZQJbhJQ8FuBF0sZJRczOWERa0 4KhQ== 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=ASU5eX9Fzb/xsl6VZmhE+3qV6oQDGd2P3b7uVl5v5h4=; b=ljJZkjYu9QISCMWutOAUIbvdjUdUVJMEpVUeiwTfkBIPAJ1/kjnXYlnLLLoOajD4Tu Bhr1+mWzKKe8nrWfuoH7h645zGATr+KSKrlus4zLNwY4FcTwBNUoDSFpYhTDXFb/Qxlw 9JahnW18Ulx33nNsVUPOV205u+Bys0GQiGmumvqlH1L15CQA4Qs44kOBoPBGAXX4i+bE t9VSRTLJj8csn/t7aYqFqjFn1PN+xk4n/Qx0iipx9NPJ3l+KwwYhAvgeby0hv1j4oC6M c2VHAb40ClJ5WK4nbAmXdHEC15pt/MF9oa9pEnvOzTD8HiDf50N3TqYldeXYPL6tLNOh /rVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WckO+FVS; 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 a21si2389259ejd.281.2020.11.16.19.48.19; Mon, 16 Nov 2020 19:48:41 -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=WckO+FVS; 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 S1728145AbgKQDnx (ORCPT + 99 others); Mon, 16 Nov 2020 22:43:53 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:2976 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbgKQDlQ (ORCPT ); Mon, 16 Nov 2020 22:41:16 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AH3dVu9018956 for ; Mon, 16 Nov 2020 19:41: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=ASU5eX9Fzb/xsl6VZmhE+3qV6oQDGd2P3b7uVl5v5h4=; b=WckO+FVSNBjOyBxwCdbZp9XrLYGm0ZyUdZLcTQh/Q/9zmw0ccItEeJUST7tCrPAG6ic9 +ilmWVPqC62mvHZrVz37e3Xlh8+yYmZAJ3s3kGsmNq1Zh2aklKRFV10qnr6qmfHaa74x g9173iI/JDkL7T72CBC/GGPvhjSTca0B4IA= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34tyxqru48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 16 Nov 2020 19:41:15 -0800 Received: from intmgw001.41.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 16 Nov 2020 19:41:14 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 6C3B7C63A7E; Mon, 16 Nov 2020 19:41:10 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v6 20/34] bpf: eliminate rlimit-based memory accounting for cpumap maps Date: Mon, 16 Nov 2020 19:40:54 -0800 Message-ID: <20201117034108.1186569-21-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201117034108.1186569-1-guro@fb.com> References: <20201117034108.1186569-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-17_01:2020-11-13,2020-11-17 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxscore=0 impostorscore=0 phishscore=0 spamscore=0 bulkscore=0 suspectscore=38 malwarescore=0 priorityscore=1501 adultscore=0 mlxlogscore=936 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011170027 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 563f96cc8a9d..7103d89a7d41 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