Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp70313pxu; Tue, 24 Nov 2020 19:07:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCJp+r0sAKL5ctW8L5nUQ8k4Ja2jwA1dOVjrhWbQG/DhC9pVJf60QSFxZo06Jq652BGW/P X-Received: by 2002:a05:6402:22ab:: with SMTP id cx11mr1505076edb.98.1606273665726; Tue, 24 Nov 2020 19:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606273665; cv=none; d=google.com; s=arc-20160816; b=roi54MUbb1HBRZe/s1aanZR+8DWHDsNBrb59ehzl5KjeH7ZbF6StOJDE+vdg7ILq2o yMUvVGYOYLfsd5ncAYG1EHTv1YkeD2bm1gVZ83zI5uKQvr4H+Q0EeYMEbaxjh2dDQocA DSBWtsA0WcGGwXBoqwTHax5x71hG4bySdw8L6a1hHELkI8BbXEw8qLNq1rbcejBj2/0E QIm2ltD54JCJjdKe3hivdXhpqHDK6EAHl6q29rdRk7lB7VMkYm4OnKVAxYHWkbWYZb2d 9d16vo2xxDtYszs7bvVpHXiDzbxqCuUjxHL7WIbfUpAYajBNiW25g6EJwvyxFYjdk5ZY FEWA== 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=TnExbMUogzHd8p7IQb5z0S0wFoIvqXTWgF/AVE8fTrA=; b=F5x1CzjAxLpnUvn2s1GMzm+T2AP53oLokH+HIhIrxkXRnxP5cix0uUcN9RGNJpi0oa tYVRuMQgia6cPp1vXmSBRx8opJl7RJHUd/oYfWADit4JmbU5tQF1/sgrGAWQGRz4BmuL 7fpPHFADd3KXsPfV+wC2g9r/wXlQg6MEgMkr+VIVenXben04mKa5+CbCJpr1T4YUlFlI uQ+VaZ7c/43gBG70gadriU76jJQWl6RcuMjPUhFNKd6hEsucLDXZymIsLX6okPxLzh4y Pjpfugut9HWotZzOw7dvL2YmNKlzeblPx/wjQziRLZKeyLA3SQiWx3535qeBnzXZ7CHM s/WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=mglrNpP5; 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 f12si514872ejk.142.2020.11.24.19.07.23; Tue, 24 Nov 2020 19:07:45 -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=mglrNpP5; 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 S1727436AbgKYDBd (ORCPT + 99 others); Tue, 24 Nov 2020 22:01:33 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:62150 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbgKYDBd (ORCPT ); Tue, 24 Nov 2020 22:01:33 -0500 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AP31RYu027593 for ; Tue, 24 Nov 2020 19:01:32 -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=TnExbMUogzHd8p7IQb5z0S0wFoIvqXTWgF/AVE8fTrA=; b=mglrNpP5xIu3ZAvZTCaVqAYaMsw9Zd8NrBsEL6T0EMI2iEehQltSZ36hGY9ByBHF9kIg Zmniy6oi30kCzLK8CeBGoWE4ruWEmt7XGWE22a98j1yyBb5DxcHfQvXgT+GOTelxjAwi gC3Xg8is7CK1fx9rygvOJoCpfaR3MpFkJgg= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34yk9gcp3f-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 24 Nov 2020 19:01:32 -0800 Received: from intmgw001.41.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) 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 7E0D416A18BF; Tue, 24 Nov 2020 19:01:22 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v8 31/34] bpf: eliminate rlimit-based memory accounting for bpf local storage maps Date: Tue, 24 Nov 2020 19:01:16 -0800 Message-ID: <20201125030119.2864302-32-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 clxscore=1015 suspectscore=13 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=682 impostorscore=0 mlxscore=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 bpf local storage maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/bpf_local_storage.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storag= e.c index abd0ea385274..0875bb46e96b 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c @@ -547,8 +547,6 @@ struct bpf_local_storage_map *bpf_local_storage_map_a= lloc(union bpf_attr *attr) struct bpf_local_storage_map *smap; unsigned int i; u32 nbuckets; - u64 cost; - int ret; =20 smap =3D kzalloc(sizeof(*smap), GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT= ); if (!smap) @@ -559,18 +557,9 @@ struct bpf_local_storage_map *bpf_local_storage_map_= alloc(union bpf_attr *attr) /* Use at least 2 buckets, select_bucket() is undefined behavior with 1= bucket */ nbuckets =3D max_t(u32, 2, nbuckets); smap->bucket_log =3D ilog2(nbuckets); - cost =3D sizeof(*smap->buckets) * nbuckets + sizeof(*smap); - - ret =3D bpf_map_charge_init(&smap->map.memory, cost); - if (ret < 0) { - kfree(smap); - return ERR_PTR(ret); - } - smap->buckets =3D kvcalloc(sizeof(*smap->buckets), nbuckets, GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT); if (!smap->buckets) { - bpf_map_charge_finish(&smap->map.memory); kfree(smap); return ERR_PTR(-ENOMEM); } --=20 2.26.2