Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5081093pjb; Mon, 27 Jul 2020 12:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHxyhSGvMQ5s3Nfg3JCf3RlFaPdG5xYkQcYUQvitqekRJXvRx/tunpERcXn1okoQYC5L71 X-Received: by 2002:aa7:c98d:: with SMTP id c13mr22430118edt.188.1595877983899; Mon, 27 Jul 2020 12:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595877983; cv=none; d=google.com; s=arc-20160816; b=ZZzJAQnC/1WJatHMilenK/X0kCIw+uCW67f2JU/awxaPwnSYTyuYm/exna5561Y/43 8TsqsTKcSy248lXv+YUR7vJzoHNkw5KXEFlpqFh1x6hGDTjg5h7MIr+6WMIs9JgOvNlh x5qgqiAxWDKb8DuWSLDftNwwVXwAPxVhRd/YusEKNZH+koyflbdXvuoUmXzBper4Kv3G Dt8FTWZ7f5VDATsAI7cxzq1NS8EbDfZ0pj/WhG+gIk80TSr1XQcTrTDtk5br0GVNNvoP IJkYIxecq22UYfmiHiwnWmbyT5n2E3hSb0qt2Ybs/oAznjexEqZiZ9l2fawzjCbakhpE kg9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:smtp-origin-cluster :cc:to:smtp-origin-hostname:from:smtp-origin-hostprefix :dkim-signature; bh=kgx1N3wv9TPtos9dN1aGlqsLHETqvrKshzL5gFr9kM8=; b=fhTHQQFbMfxKo8OlyVVHzXzuPe8LDoQta297S75lyy2luuEfzRjbDAvVbiuefVrcxW uCZZ863SgSSejNz9k3wGe8dEETSZikeMX6gjK4WyD/i2tAk0Sg5qxQytmf2s9s12IKm5 UoYGci5J59N6yj66IWZzTMpk7YbNQlLtuE0PQoH0CaG9B3/7AuxAoks7uVhw9yv6FTMN so9IvSc7nUzuKfLjSjpgXJD0JydQlNtJkRL7A1Umtr43LzA4Yf+DFZhGX7ZfKFx+EF3E 42SuBgtaZva3M56pycxx8aOfF7tZoY+lrMwO5g9CaKRcrn381sVDw6I2cPrPEX6HqPAW STow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=PlTmEP7r; 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 d16si943755eds.521.2020.07.27.12.26.01; Mon, 27 Jul 2020 12:26:23 -0700 (PDT) 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=PlTmEP7r; 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 S1732393AbgG0SrW (ORCPT + 99 others); Mon, 27 Jul 2020 14:47:22 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:47344 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731925AbgG0Spi (ORCPT ); Mon, 27 Jul 2020 14:45:38 -0400 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06RIiO5c009882 for ; Mon, 27 Jul 2020 11:45:37 -0700 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=kgx1N3wv9TPtos9dN1aGlqsLHETqvrKshzL5gFr9kM8=; b=PlTmEP7rRyNPlxeWJKpCkdYfMlCRcicBVV5rhBcWoZG4EbG8wJwabOoNDbGiDW7agYOJ sMVw5SH2n6a66f1SS9236oNS8JV2U0O5o0Hc9kFMP/gghP0TULnAK4QWuErJisj8nA1+ 3qHT0dBu+re0IicJwk06Pk9oGIwouQuBHrE= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 32gj8kga56-16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2020 11:45:37 -0700 Received: from intmgw001.06.prn3.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, 27 Jul 2020 11:45:16 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id E8CA61DAFE97; Mon, 27 Jul 2020 11:45:10 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm1096.prn0.facebook.com To: CC: , Alexei Starovoitov , Daniel Borkmann , , , Roman Gushchin Smtp-Origin-Cluster: prn0c01 Subject: [PATCH bpf-next v2 19/35] bpf: eliminate rlimit-based memory accounting for lpm_trie maps Date: Mon, 27 Jul 2020 11:44:50 -0700 Message-ID: <20200727184506.2279656-20-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200727184506.2279656-1-guro@fb.com> References: <20200727184506.2279656-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.235,18.0.687 definitions=2020-07-27_13:2020-07-27,2020-07-27 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 adultscore=0 mlxlogscore=764 spamscore=0 impostorscore=0 malwarescore=0 suspectscore=38 bulkscore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270127 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not use rlimit-based memory accounting for lpm_trie maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/lpm_trie.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index d85e0fc2cafc..c747f0835eb1 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf/lpm_trie.c @@ -540,8 +540,6 @@ static int trie_delete_elem(struct bpf_map *map, void= *_key) static struct bpf_map *trie_alloc(union bpf_attr *attr) { struct lpm_trie *trie; - u64 cost =3D sizeof(*trie), cost_per_node; - int ret; =20 if (!bpf_capable()) return ERR_PTR(-EPERM); @@ -567,20 +565,9 @@ static struct bpf_map *trie_alloc(union bpf_attr *at= tr) offsetof(struct bpf_lpm_trie_key, data); trie->max_prefixlen =3D trie->data_size * 8; =20 - cost_per_node =3D sizeof(struct lpm_trie_node) + - attr->value_size + trie->data_size; - cost +=3D (u64) attr->max_entries * cost_per_node; - - ret =3D bpf_map_charge_init(&trie->map.memory, cost); - if (ret) - goto out_err; - spin_lock_init(&trie->lock); =20 return &trie->map; -out_err: - kfree(trie); - return ERR_PTR(ret); } =20 static void trie_free(struct bpf_map *map) --=20 2.26.2