Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp34123ybg; Mon, 27 Jul 2020 22:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaurPHwxb71ewn3vil9foaxB936olbEAs5sqt+MJ0nb1VFiGL+bONFXxE5tSVRm7keoqS8 X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr19664094ejz.239.1595914290086; Mon, 27 Jul 2020 22:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595914290; cv=none; d=google.com; s=arc-20160816; b=cUhWDxmB9MEd4gv19zHhxLBaTRh9RzpOWy6Di3CnnW5133DeigPIB5nU46WZlUaTA4 3daZ/Uo2aDzT+411oZj0dH3F80MjAmE4SpsWmw0hxh8Q/bsZskT9+EH/Rx7k3hqguDLu klDEsZfDEjpLz0D6s8t3hS1KAaO9Twkdg5Qsa+bLSbUWcv0eMdoJ/KitFHWonltm2cjD UcXuvYc36kenf88ibE6H1cwRtyH3f5IEHkNoOD8D0LWst57CkJNV33BNM1eNuri6xBXj 2mYpduMfNnFNDAmB+wZ+QfBgYr2xa4clPr85vS0j5SwvRNn7FA8mBleerPHl84VQ8bMj VFIA== 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=qyHVIvQ1elgVxWRKfmuWCP+GGEHS8ZT0O8xjeSueKdg=; b=YjoeL7RsrY1PLH2gky7YkyJns7ijipaKj+JDssvIDKkQ3AnKeTNsTrMHmJW11X8PMW MpdiyWApNt/uPFF7W8oV51MqiJtvgNrhsUJsIqjt8Cq3ZdqoNk9vj328ROCPk/eY5Ip3 w7r6j0gq8BbYeEpCGoDYNLrzeagkq4TzKDJXmYCKn6KYNjvswjNKa7BntOWv0F2B7B31 O8u3Mi8NsJKv6sB1Y8vxdVEvkbIqE2mtPC0NrPw0kRZhSGnRN2mh9ntLyzvnpye93/Jb WoUU50f4L67ed674rdXUKdaOEiTkDcYoYVsG6Jwyhpa5CYPVkFGYwv22pd2xKZWfzlk+ 0ZDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P1WNNLpP; 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 mm22si2486917ejb.735.2020.07.27.22.31.07; Mon, 27 Jul 2020 22:31:30 -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=P1WNNLpP; 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 S1726873AbgG1Fat (ORCPT + 99 others); Tue, 28 Jul 2020 01:30:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:42534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbgG1Fas (ORCPT ); Tue, 28 Jul 2020 01:30:48 -0400 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 0085A20759; Tue, 28 Jul 2020 05:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914248; bh=gBdRHY3hhfymtWLH0XkstzchGZQpmabzhAQ4I9TsFBM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=P1WNNLpPb3cs+ClJdI7wYuPqxXAiahL4fPF1oTNP7mzfvH0VaQOuG1ZkDZpPuiLxO EzdcdxoVUHBEAdng1ayEsW3bM1x5HZrlb0mxzwN1ykDGsIOzkDXyGA8Nxv+VmyxQhh 80CLXBQaivSLe8VkuP6IMrvO9JItEL/Qi726MDJs= Received: by mail-lj1-f169.google.com with SMTP id s16so4516967ljc.8; Mon, 27 Jul 2020 22:30:47 -0700 (PDT) X-Gm-Message-State: AOAM530au6S5MK3W8/IwOIu+GOtTJFIste2zvpSd/Pf+uE2hDKAC2wNM DyybHVtFwWm0A+w+UJxlYfXOf/ugZUkeLi9a23Y= X-Received: by 2002:a2e:3003:: with SMTP id w3mr11841791ljw.273.1595914246316; Mon, 27 Jul 2020 22:30:46 -0700 (PDT) MIME-Version: 1.0 References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-16-guro@fb.com> In-Reply-To: <20200727184506.2279656-16-guro@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 22:30:35 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 15/35] bpf: eliminate rlimit-based memory accounting for cpumap 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 cpumap maps. > It has been replaced with the memcg-based memory accounting. > > Signed-off-by: Roman Gushchin Acked-by: Song Liu > --- > kernel/bpf/cpumap.c | 16 +--------------- > 1 file changed, 1 insertion(+), 15 deletions(-) > > diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c > index 74ae9fcbe82e..50f3444a3301 100644 > --- a/kernel/bpf/cpumap.c > +++ b/kernel/bpf/cpumap.c > @@ -86,8 +86,6 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr) > u32 value_size = attr->value_size; > struct bpf_cpu_map *cmap; > int err = -ENOMEM; > - u64 cost; > - int ret; > > if (!bpf_capable()) > return ERR_PTR(-EPERM); > @@ -111,26 +109,14 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr) > goto free_cmap; > } > > - /* make sure page count doesn't overflow */ > - cost = (u64) cmap->map.max_entries * sizeof(struct bpf_cpu_map_entry *); > - > - /* Notice returns -EPERM on if map size is larger than memlock limit */ > - ret = bpf_map_charge_init(&cmap->map.memory, cost); > - if (ret) { > - err = ret; > - goto free_cmap; > - } > - > /* Alloc array for possible remote "destination" CPUs */ > cmap->cpu_map = bpf_map_area_alloc(cmap->map.max_entries * > sizeof(struct bpf_cpu_map_entry *), > cmap->map.numa_node); > if (!cmap->cpu_map) > - goto free_charge; > + goto free_cmap; > > return &cmap->map; > -free_charge: > - bpf_map_charge_finish(&cmap->map.memory); > free_cmap: > kfree(cmap); > return ERR_PTR(err); > -- > 2.26.2 >