Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp69262pxu; Tue, 24 Nov 2020 19:05:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjH2EsttwzviRZjTz8oyZyNpuoALzQ0GGtENE3SWvGAudJHaBmvCYUNXk9NU8XPLW70umr X-Received: by 2002:a17:906:4348:: with SMTP id z8mr1379647ejm.119.1606273531058; Tue, 24 Nov 2020 19:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606273531; cv=none; d=google.com; s=arc-20160816; b=ENmdF6YD+SDkJXCaW+Gozb7oOMhw0tjA3iQvjCGmW2SDc9qwdmM2l2SXIkNa9BDXph riR+FgveugqhpY9nmoW+AMRcfXOEg4TB9zxvWXKGuUMpFHk5+Uo1ywgKTum7yN6ZmlHe VvM1dwzstgQC5LWbDX/F/DQybvJx3zIpYj9G3nO1eKEsvU5sVnIicbt8WpX33BuAeEly GdaLhv2zjNkFPrTvQeeLY7dPKUxSof78nYbQpbN+5oPVTSJDAdiwffLDbH9kT+jKRCDg llON0WzfzXE7xYVO3bI5vfFoRZRTM2XjAo/3TPQ2Smc1mq7HV/w9w2svMjpdEqyeyZSm 2Tzg== 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=M6nI7BN0unMH8lLVYY0WWTngfpCmQVxP1GeXrD6hnIE=; b=CwfY6QkTK9FWRrsplMbG0yO/rKLw4l1HMh7FZ4/+6vbRF2CG3KVP3MvhKJYq0IKt+B hONz5v5/p1a6ysIk6PBW/mE0MudD99Vpbrdgpmy9dNjQY+C5R1ECuSTmMC5MyeAfIqEb clFk+UdIIlLe6+4UksDf1BVfAe1a1k8Xs9snzpK4UowBJ9gzxg31q4kjFl0dycVWBZSO /NZqvgmmWYPWZMN9vjOZn/zy1iRYXowA71Zf7zEF0Kco/uteLYui3+1LQjHHg3Sqiueg J3dO3zYg9E49AsvL9jCFQ457/vH8hTgPOq0EEM24F7mmJ1U8nom3zaalkYW3NqLb9DDQ fKJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=DvLt5WsZ; 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 qt13si493317ejb.358.2020.11.24.19.05.08; Tue, 24 Nov 2020 19:05:31 -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=DvLt5WsZ; 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 S1728076AbgKYDCG (ORCPT + 99 others); Tue, 24 Nov 2020 22:02:06 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:64264 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727590AbgKYDBh (ORCPT ); Tue, 24 Nov 2020 22:01:37 -0500 Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AP2sY2t031124 for ; Tue, 24 Nov 2020 19:01:36 -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=M6nI7BN0unMH8lLVYY0WWTngfpCmQVxP1GeXrD6hnIE=; b=DvLt5WsZJKss0Fcxr+FGiUhxilg/0AGLO8kWyoJ+wOir+ChJmB2BQljurUE2cwTLcNtO zaABKJbQvvcuka2onw4s3k7be2wQYho0QDxzZu1Ql3WSzEcomFTCg4lPMFVSaMnGDtHj zu1FSbB1wZV0M56F4LS29PbltXamx8iSROw= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 34ywv0u3ck-13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 24 Nov 2020 19:01:36 -0800 Received: from intmgw002.41.prn1.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::f) 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:30 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 7256B16A18BB; Tue, 24 Nov 2020 19:01:22 -0800 (PST) From: Roman Gushchin To: CC: , , , , , , , Subject: [PATCH bpf-next v8 29/34] bpf: eliminate rlimit-based memory accounting for stackmap maps Date: Tue, 24 Nov 2020 19:01:14 -0800 Message-ID: <20201125030119.2864302-30-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 suspectscore=38 mlxlogscore=765 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1015 impostorscore=0 spamscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011250018 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not use rlimit-based memory accounting for stackmap maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/stackmap.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index 06065fa27124..3325add8e629 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -90,7 +90,6 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *= attr) { u32 value_size =3D attr->value_size; struct bpf_stack_map *smap; - struct bpf_map_memory mem; u64 cost, n_buckets; int err; =20 @@ -119,15 +118,9 @@ static struct bpf_map *stack_map_alloc(union bpf_att= r *attr) =20 cost =3D n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap); cost +=3D n_buckets * (value_size + sizeof(struct stack_map_bucket)); - err =3D bpf_map_charge_init(&mem, cost); - if (err) - return ERR_PTR(err); - smap =3D bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr)); - if (!smap) { - bpf_map_charge_finish(&mem); + if (!smap) return ERR_PTR(-ENOMEM); - } =20 bpf_map_init_from_attr(&smap->map, attr); smap->map.value_size =3D value_size; @@ -135,20 +128,17 @@ static struct bpf_map *stack_map_alloc(union bpf_at= tr *attr) =20 err =3D get_callchain_buffers(sysctl_perf_event_max_stack); if (err) - goto free_charge; + goto free_smap; =20 err =3D prealloc_elems_and_freelist(smap); if (err) goto put_buffers; =20 - bpf_map_charge_move(&smap->map.memory, &mem); - return &smap->map; =20 put_buffers: put_callchain_buffers(); -free_charge: - bpf_map_charge_finish(&mem); +free_smap: bpf_map_area_free(smap); return ERR_PTR(err); } --=20 2.26.2