From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D47AC433E8 for ; Tue, 28 Jul 2020 05:38:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A13920792 for ; Tue, 28 Jul 2020 05:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914715; bh=kudBUbPYRIeiM4+47AqFUj+ZhdDE0WK7VWzk+AsvqF8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=nk/B8CA+7hMpnTWZfdk9K/qPI60rKtiTdSuhq/edMDFb8p5fOFx2cubkJfZf0KrZS cyAvXUayAHlp/zxlnO8H5mVSkTo0oV0+8kBHNFbCuIdjMLJrC0W2DyQUbUUSFHEm+V CNg/8dT7JbONrCB7keWenRiDZ0QY8oJIuH22WpFg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgG1Fie (ORCPT ); Tue, 28 Jul 2020 01:38:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:44704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbgG1Fid (ORCPT ); Tue, 28 Jul 2020 01:38:33 -0400 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 44A4321D95; Tue, 28 Jul 2020 05:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914712; bh=kudBUbPYRIeiM4+47AqFUj+ZhdDE0WK7VWzk+AsvqF8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hInOE7+y5Fpi5W4zXMbOEdFfW83PX6I01vR1lHuhWtV+CXX7D9Kjff3zVl3NPo4Ow pO4FKUHUNTaE1+cMw7meKcSf8mlB2lmRP9ZS26X3ji69SxraAAwyfWIDOai5Luwni6 FzuXKI2WJo7px1mwHCIMXYyJ7PCYW77eJHDvCHWg= Received: by mail-lf1-f47.google.com with SMTP id y18so10286247lfh.11; Mon, 27 Jul 2020 22:38:32 -0700 (PDT) X-Gm-Message-State: AOAM532A3U+nYJRL9ZgmB5jxUWVGk8Y9U9YN1d25ANRsbj1ELTqFv4uc UiCMm1MOmjOUYmpYMGyCo+Yj23edkdbTReLzIsE= X-Google-Smtp-Source: ABdhPJyrFPzlDFJYgCalqg8Zv+yEzwKXrT9R4Ak9o5L/7YzejJFWLaYAllzlVJsHgsJ72RpZyKcn+mc+OPrltZ28u3E= X-Received: by 2002:a19:7710:: with SMTP id s16mr13555854lfc.162.1595914710550; Mon, 27 Jul 2020 22:38:30 -0700 (PDT) MIME-Version: 1.0 References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-25-guro@fb.com> In-Reply-To: <20200727184506.2279656-25-guro@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 22:38:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 24/35] bpf: eliminate rlimit-based memory accounting for stackmap 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:22 PM Roman Gushchin wrote: > > 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 5beb2f8c23da..9ac0f405beef 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); > } > -- > 2.26.2 >