Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp36417ybg; Mon, 27 Jul 2020 22:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFAct71LQ8SiP3z0g77CQXq0qWEV8VqRUkdikLxfNQOvHcGmY3ZxGR05Bhy5pofXrX/1wt X-Received: by 2002:a17:906:64d7:: with SMTP id p23mr8247996ejn.185.1595914570813; Mon, 27 Jul 2020 22:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595914570; cv=none; d=google.com; s=arc-20160816; b=E+/OMoDqZhzZljAlXgx4ff4t2z7vmhm9gmDjMaZG9w1LKU0KH0CZs0pFP5/XGaOswq OPvu824FSDc2HTE8AZaG7LLXs35SXal4s5px3gLqvMhcg9Jjy3ij9OeZY3WVrMsFG2VK zJYxQFCQbWtgof/Kem4D4ElHNXvnhh1gkyzgRNvmeHAKfuQartUaQVruLw75e6oBFrNB +Wb0RknvtKB7Bxhgyu7m0fMyLwL1Q7peQK4h6WhvKwBjasPm71ZkVosgMQRT7ANeaMT+ AeLRyz6HR9v1Iz7TdunbbV9YHUTsrdwPXQAKCptLdm/ei/dd+BwqzLnMf2tWo6daDmts Aumw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=24u+qOOrGJqvvSNaMns4MAETKbaz7EU4VIBcfVOZ/JI=; b=TBd06fSLB54tkM5KUc+nDCAv64G2pEnO6iZWof/gVeyvtz5lMVJPN/2pKsbFNY2SHy gICqvNzh7j+2FWeXqjBWO98UEX1yDkeh2JBfGzCKpSA5vyxlh3WIgADlrFNqrfCID5JM 5N2Gt97mosIa0GiW060TUNVvAp+cr8lkLVw86/NOMD2OSdnCb+JuJBVmdvQkVHyQ0UlL JtjxtA4N2i95tuY69AwZXBGQTPrw8JikvPRX9CY5gQ341XAXtl0C8J1UK5dp3PYDo1Sp nGGKd5N74o6xBKtnsQLAfLkrcOq4037oRi5i8MwL1LEmvsu04CCIIJWcJqIfya2weRgy SnJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PtA8P4Yo; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si6723601edv.128.2020.07.27.22.35.48; Mon, 27 Jul 2020 22:36:10 -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=@kernel.org header.s=default header.b=PtA8P4Yo; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727091AbgG1Fcu (ORCPT + 99 others); Tue, 28 Jul 2020 01:32:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:43132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbgG1Fct (ORCPT ); Tue, 28 Jul 2020 01:32:49 -0400 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B160F20829; Tue, 28 Jul 2020 05:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914369; bh=7fZc0YPRr1LmxCFj3GVuv6A1HWSBq66zW/yYIQ2J5L4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PtA8P4Yoa0OVOGlP0bitg0RsWdZ/LIoDqvRKl28qVvsl98gzzTApb/1M/8ciTXyhi BeWVvw4u4ENtrPrSPr0sNrqTpMr95ECsFIIdik7atAmz7gQBp6Rz/RnKHp/SZ9pZZ/ mnVR9gzaB0Lq7z0Kh6j+vg/q3gEjACy3CdMoIZ1k= Received: by mail-lf1-f44.google.com with SMTP id i80so10282402lfi.13; Mon, 27 Jul 2020 22:32:48 -0700 (PDT) X-Gm-Message-State: AOAM531VjdBqNsprVktMtrDTxKVNBYGkYWBRObUPXXM0EaehYm4TJ+p/ QzB9kcuEBmzGeCk0G3ZMdtCInQXBJzvqrpJCjas= X-Received: by 2002:ac2:5683:: with SMTP id 3mr13215297lfr.69.1595914367019; Mon, 27 Jul 2020 22:32:47 -0700 (PDT) MIME-Version: 1.0 References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-20-guro@fb.com> In-Reply-To: <20200727184506.2279656-20-guro@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 22:32:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 19/35] bpf: eliminate rlimit-based memory accounting for lpm_trie maps To: Roman Gushchin Cc: bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 27, 2020 at 12:25 PM Roman Gushchin wrote: > > 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 Acked-by: Song Liu > --- > 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 = sizeof(*trie), cost_per_node; > - int ret; > > if (!bpf_capable()) > return ERR_PTR(-EPERM); > @@ -567,20 +565,9 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr) > offsetof(struct bpf_lpm_trie_key, data); > trie->max_prefixlen = trie->data_size * 8; > > - cost_per_node = sizeof(struct lpm_trie_node) + > - attr->value_size + trie->data_size; > - cost += (u64) attr->max_entries * cost_per_node; > - > - ret = bpf_map_charge_init(&trie->map.memory, cost); > - if (ret) > - goto out_err; > - > spin_lock_init(&trie->lock); > > return &trie->map; > -out_err: > - kfree(trie); > - return ERR_PTR(ret); > } > > static void trie_free(struct bpf_map *map) > -- > 2.26.2 >