Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp69586pxu; Tue, 24 Nov 2020 19:06:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7wYm3M23+RaStvP88RdrOGaz85dVnrNJM2usk6tdt0NwHjQ2SNYpFkOsB2cyqUqZqoKDy X-Received: by 2002:a50:e68b:: with SMTP id z11mr1546203edm.25.1606273567562; Tue, 24 Nov 2020 19:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606273567; cv=none; d=google.com; s=arc-20160816; b=jXKrs7Dsjya8SxciyDQGQVCO4omv2FHTQm/SVBfRkVdqYFsrWRL6bz/BkIn+LETnC9 Ltky9Uxx59onOQghZU4pm2L2gaSLMH/An6WbNhGXzJmMh8yAD67t4H/rZ7jGYSxcTK6h fEDnOZeLqHsZbGs1IC4vv4iZgB2YcwaYBMPvQyd20d7WAx8/g1aj06sSlwlX0vlk/4st +2Z8u0Mif3iTwcBcHiurJFZfObXzB7Ru3qla+Tw9KEhThEYWtQIFBGD/HpXouTfQ1sQF Rbrb+WsFNCTGpWCa//fVgX2CyxdSpdfbUc1A0FexKW3OYGFvDpxKdCCaAOAY6ycTnEpI cGJA== 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=wegWooh9Tlksfpaky3k/bo7vLu7BokCFBuFzgnYWeck=; b=LTFr4NeSBR7p1HrQo219pB6kxjAsOD3CLE3PrkxHItfQb+O3INdNv+blx28U0m4879 Ii4IBbE4O5QiOT6gPsuNk99fbg55kt1d5yl6m+8nzcWz77aUxGd9ZlxOH8TBlETgstxa GxRaJ/8w8z1UsEX5NSS58Octlvuhb4leuej5YTb/0Uqtvu0XR8PeMWjl4xqskNuLfDLf iiIFFbOkourBQ2D1pwEnRaDcxg8h5C/H7vqu/67Iw8NtppwKXFpbjl+KzhsFgDRa1WAf +4hOMPoXY1yh9mWH9JqKg+twsyUHJkiczrjpq6iXKOIWO01KjXIrMsnnTwJaZD+S4+VB ElHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=G93rPf+U; 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 i23si24506ejg.680.2020.11.24.19.05.45; Tue, 24 Nov 2020 19:06:07 -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=G93rPf+U; 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 S1728461AbgKYDDI (ORCPT + 99 others); Tue, 24 Nov 2020 22:03:08 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:23346 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727398AbgKYDBb (ORCPT ); Tue, 24 Nov 2020 22:01:31 -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 0AP30VsY002315 for ; Tue, 24 Nov 2020 19:01:31 -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=wegWooh9Tlksfpaky3k/bo7vLu7BokCFBuFzgnYWeck=; b=G93rPf+U8EtlU6zEqzFWpxV237CEeJ4Q7CNq55fO/loZvYzqU4rbg/ljGZMlv0X/kNz8 Unls9IRaF/pwS9DzRlE8xkVJ8HzO4gAGFhmRHNt29yEn0I0HNASkndJxRbX0h3sRYBVk N7k3b6apOObwnoTrdsRDFztdZmC+MpDpbYg= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34yk904r0x-15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 24 Nov 2020 19:01:30 -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:27 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 477B716A18A9; Tue, 24 Nov 2020 19:01:22 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v8 20/34] bpf: eliminate rlimit-based memory accounting for cpumap maps Date: Tue, 24 Nov 2020 19:01:05 -0800 Message-ID: <20201125030119.2864302-21-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=38 malwarescore=0 mlxlogscore=926 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 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 e6b234d5e3a8..20e8da8a2ac2 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