Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp36433ybg; Mon, 27 Jul 2020 22:36:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykZPeh7W1akhbOeNVkFgKjocopMz6M1msOLpJ31TDi2/WdVvO7wrFL/wKJkVpIA8N5xLGM X-Received: by 2002:aa7:c545:: with SMTP id s5mr24074808edr.19.1595914572600; Mon, 27 Jul 2020 22:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595914572; cv=none; d=google.com; s=arc-20160816; b=vHhCAttxao1CP14qMvqgxo64r7er9DeD4oZGFHhPJgE3pzA6EkOGj+/bgif3i7cvcG 8zXpMuIsfdNb4VV2yB4dlvoZJarATX4g+xeyci9lPSjL6hasHskISCf9BTYMct7wavjZ hZo/+DgtrHYpMZVYaaJfepgxVjCtjI9neWXOtY9+A49MHs1k/Kr69xw3PlIeUeKrpq1t Oj7h9LR4CzdwSi/bLLEKh5Za4xbWXNMSe+66MZ0ckheT5TI3ne6Q09M45WRbCHr11Xpc oULHYEyb4uyXqmCTT4fk6hjAZOx7Kkt1q33MEU1OPPfzj9vdvkhylbZEn5HMrCWd97jL 0VyA== 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=stg7FvycIP2fX5l+7UiC7tP7XBE/blxOWttvXffBRiw=; b=vVsTRoNGtXQZ45HLwJWmjeZ+by81rFXpIBQAVipeS946Sw8MRTG8DYDdyqie0DqnCe 5MTpKZYjH1v3orjczQM4SOuh9YmmNH4I2Pb+6B1IHYAbJPPxxd6GatRv+9VhKft1yKVt FpEVYD6XU2SYJ0urzdjJTsdZumZLB5EJRM8f6G4nneg4Hp6DwhamQYlwjlP8Dq752O0L 3aI2I1k/iT3/2Tfe+uVZq+GbTHF2DPa9nF0uNJpBw7TYZRO8MHNyD4kOxceYAhi2elPM yAXdMZa+8fQgsQtqw7XFc1/fFb3TctIv5nUJE4XuK21i/V6JG0u5DxYuOukv7F5LLdcR 0/4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EcNitXg0; 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 o24si2896346eji.60.2020.07.27.22.35.50; Mon, 27 Jul 2020 22:36:12 -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=EcNitXg0; 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 S1726581AbgG1Ffd (ORCPT + 99 others); Tue, 28 Jul 2020 01:35:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:43472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbgG1Ffd (ORCPT ); Tue, 28 Jul 2020 01:35:33 -0400 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 6EF0621744; Tue, 28 Jul 2020 05:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914532; bh=zx7VWFCJ2PMJ/+Cqt+H06tQgYu2lqiv9yLovQHJzjWc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EcNitXg0qAG43LHfC4hLtq2qjsXiNcwJ37LNAH2i28lHZQiKtccWWISbiFDTy05B0 DxpHe/EqHY4Fh9nQHhfrEQ6BftNnz550fn9s29BLdA7dX48j+F+uwrssFK3Cwu2tZE xfzsVTFU7XC+ANnbiZK1S45s3hacJhEUCZtAV0Ac= Received: by mail-lj1-f177.google.com with SMTP id d17so19754172ljl.3; Mon, 27 Jul 2020 22:35:32 -0700 (PDT) X-Gm-Message-State: AOAM532Wf0Iwv2Pq8t2aqy6VvObMWZrrY5skadQDuyOZCu5H52ZSIGWE I3IyIabtUJdln29C+gyWR+mUmBXqpSKsjLm4Nwo= X-Received: by 2002:a2e:81c2:: with SMTP id s2mr3272036ljg.10.1595914530748; Mon, 27 Jul 2020 22:35:30 -0700 (PDT) MIME-Version: 1.0 References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-21-guro@fb.com> In-Reply-To: <20200727184506.2279656-21-guro@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 22:35:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 20/35] bpf: eliminate rlimit-based memory accounting for queue_stack_maps 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 queue_stack maps. > It has been replaced with the memcg-based memory accounting. > > Signed-off-by: Roman Gushchin Acked-by: Song Liu > --- > kernel/bpf/queue_stack_maps.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/kernel/bpf/queue_stack_maps.c b/kernel/bpf/queue_stack_maps.c > index 44184f82916a..92e73c35a34a 100644 > --- a/kernel/bpf/queue_stack_maps.c > +++ b/kernel/bpf/queue_stack_maps.c > @@ -66,29 +66,21 @@ static int queue_stack_map_alloc_check(union bpf_attr *attr) > > static struct bpf_map *queue_stack_map_alloc(union bpf_attr *attr) > { > - int ret, numa_node = bpf_map_attr_numa_node(attr); > - struct bpf_map_memory mem = {0}; > + int numa_node = bpf_map_attr_numa_node(attr); > struct bpf_queue_stack *qs; > - u64 size, queue_size, cost; > + u64 size, queue_size; > > size = (u64) attr->max_entries + 1; > - cost = queue_size = sizeof(*qs) + size * attr->value_size; > - > - ret = bpf_map_charge_init(&mem, cost); > - if (ret < 0) > - return ERR_PTR(ret); > + queue_size = sizeof(*qs) + size * attr->value_size; > > qs = bpf_map_area_alloc(queue_size, numa_node); > - if (!qs) { > - bpf_map_charge_finish(&mem); > + if (!qs) > return ERR_PTR(-ENOMEM); > - } > > memset(qs, 0, sizeof(*qs)); > > bpf_map_init_from_attr(&qs->map, attr); > > - bpf_map_charge_move(&qs->map.memory, &mem); > qs->size = size; > > raw_spin_lock_init(&qs->lock); > -- > 2.26.2 >