From patchwork Thu Nov 12 22:15:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 11902037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFB60138B for ; Thu, 12 Nov 2020 22:36:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 80C0D22227 for ; Thu, 12 Nov 2020 22:36:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="loWeWcW4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80C0D22227 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=fb.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3E0C16B0081; Thu, 12 Nov 2020 17:36:36 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 36B086B0087; Thu, 12 Nov 2020 17:36:36 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E91EA6B0083; Thu, 12 Nov 2020 17:36:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id A063F6B0085 for ; Thu, 12 Nov 2020 17:36:35 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4B899181AEF0B for ; Thu, 12 Nov 2020 22:36:35 +0000 (UTC) X-FDA: 77477226750.17.night30_1f016072730a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 37C67180D0184 for ; Thu, 12 Nov 2020 22:36:35 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,prvs=85855ab1a6=guro@fb.com,,RULES_HIT:30054:30064,0,RBL:67.231.153.30:@fb.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10;04y8x66s34ukcna31bbyoazc6sy6kopbcxx73fqyyhmzryfqbekpyhbtjjq4qox.ebxywcw4w3qyh9cr713czxhhpgwujm6agqypzbfm9iqiyqptno61ao8xbtbmsao.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:75,LUA_SUMMARY:none X-HE-Tag: night30_1f016072730a X-Filterd-Recvd-Size: 4723 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 22:36:34 +0000 (UTC) Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.42/8.16.0.42) with SMTP id 0ACMOArO007594 for ; Thu, 12 Nov 2020 14:36:33 -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=loWeWcW4EwJRAl2fC600EHzYjE2RjOQwzeIAQI+K9LXWCTA/UtE3kGt8suBZQ+5U5MC0 y0ZHPk8ZoG2aSaZ1t8my7CUWAe4fj5EAPcFZzEBqEBY/WpFIB3aBzaPijCczGpk75rTu /EHWyDCvh2WD8lWTM3TEqAdt+IOYWd8+dRM= Received: from maileast.thefacebook.com ([163.114.130.16]) by m0001303.ppops.net with ESMTP id 34rva9drhy-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 12 Nov 2020 14:36:33 -0800 Received: from intmgw003.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::e) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 12 Nov 2020 14:36:31 -0800 Received: by devvm3388.prn0.facebook.com (Postfix, from userid 111017) id 5C721A7D23C; Thu, 12 Nov 2020 14:16:01 -0800 (PST) From: Roman Gushchin To: CC: Alexei Starovoitov , Daniel Borkmann , , Andrii Nakryiko , Shakeel Butt , , , , Roman Gushchin , Song Liu Subject: [PATCH bpf-next v5 29/34] bpf: eliminate rlimit-based memory accounting for stackmap maps Date: Thu, 12 Nov 2020 14:15:38 -0800 Message-ID: <20201112221543.3621014-30-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201112221543.3621014-1-guro@fb.com> References: <20201112221543.3621014-1-guro@fb.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-12_14:2020-11-12,2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxlogscore=756 malwarescore=0 clxscore=1015 spamscore=0 priorityscore=1501 suspectscore=38 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120127 X-FB-Internal: deliver X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 = attr->value_size; struct bpf_stack_map *smap; - struct bpf_map_memory mem; u64 cost, n_buckets; int err; @@ -119,15 +118,9 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap); cost += n_buckets * (value_size + sizeof(struct stack_map_bucket)); - err = bpf_map_charge_init(&mem, cost); - if (err) - return ERR_PTR(err); - smap = bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr)); - if (!smap) { - bpf_map_charge_finish(&mem); + if (!smap) return ERR_PTR(-ENOMEM); - } bpf_map_init_from_attr(&smap->map, attr); smap->map.value_size = value_size; @@ -135,20 +128,17 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr) err = get_callchain_buffers(sysctl_perf_event_max_stack); if (err) - goto free_charge; + goto free_smap; err = prealloc_elems_and_freelist(smap); if (err) goto put_buffers; - bpf_map_charge_move(&smap->map.memory, &mem); - return &smap->map; put_buffers: put_callchain_buffers(); -free_charge: - bpf_map_charge_finish(&mem); +free_smap: bpf_map_area_free(smap); return ERR_PTR(err); }