Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp39815ybg; Mon, 27 Jul 2020 22:44:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHjrAop6bGddby9V3G7KourK/d7brgAKGPhvc0SQ1FcuLCfdN3qZGAJJ9TzSLp/uzuhC1k X-Received: by 2002:a17:906:3c59:: with SMTP id i25mr14065572ejg.202.1595915082781; Mon, 27 Jul 2020 22:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595915082; cv=none; d=google.com; s=arc-20160816; b=zr0cD0MSsq8xAa6ZZoNoFsUrLvmtbffBLcZrUZGpPLwpVT3ow7TgFNyFUfmu7WV66V zeg9zKr26SAOKMlnOnmQ6T6sQJZChAu3SGxNmrgKQMhMER+QLexg3km1NmU8lJIVrq2L oWOnc54WJxRoxGjvP4IFgiKDq2NcZh0nGVYN62iO+QY0G2RzbYDMBDcU/OYHb/bXg354 vVSjOtYSG/ulE5yxWgbrDBBJfI5Z/OmQwQ4neZy80Eh+NvA+qlhVLWSSREbffePq/UEq U/KGvoenRlh3iFPS0YQ0LCxYK526Wq9eCCT0ie8hCUL3t5HqtALGvl1u/iikli55ItRG ZisA== 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=bTOcX0Oz0T2A35Wiymhj1NujSIiN9wJQh0wuVCZGrpk=; b=NFrk9qKKZLwtvFOUgNIl/GgCJXf6G3MbPhu+RnzjjJuo+ZMSpV8L4kQwycBKSjLB+h Rj9FaQkgQG08FpzTK3mgWYkfEU0NtTEyEsCEuDqkwrpGdIhKMSLrOwLuZJtdj8pJnb+S AdjFav6gRTvNSmH7mKgEimvCksmWv+tLWO6PMLK6rCIIkGwleby0xbtcftNbJyb4oA2q Bw8K39iqrJ1FRAdWX0Tw0q0Qci9x8Vjr5pRYC2FPf8hLPM827CdeefyNwQF9Rpmb1Ox3 yZ+9UBevNuMrcFtrwbkc87SHTjjgovMq4P8gl7IFESKDyJI00iqoJzY29mwLIw99k0b3 7Yfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iODAxcjc; 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 j12si7607465edn.287.2020.07.27.22.44.20; Mon, 27 Jul 2020 22:44:42 -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=iODAxcjc; 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 S1726839AbgG1FmM (ORCPT + 99 others); Tue, 28 Jul 2020 01:42:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:45630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbgG1FmM (ORCPT ); Tue, 28 Jul 2020 01:42:12 -0400 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 6526721883; Tue, 28 Jul 2020 05:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595914931; bh=vZYUADPnamCQAhCKTU043kC1heWmZ4ILNRVZg14V7Ns=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=iODAxcjceP7CCd/lyOoJ3iPcDLhQnhB+VjJNdZvkG1pqG3ACqZBihGPcMGjj6sOsQ LESg75WWFGpLDI0cFzHwMuhe2DwhOANXNrZKZgUC1nq4gOz23RDie4Js3ntYqTHj1x 1+kA3oo9BAEIWp7axkLzQFeaW8/kb2E16it6Igys= Received: by mail-lf1-f53.google.com with SMTP id i80so10292565lfi.13; Mon, 27 Jul 2020 22:42:11 -0700 (PDT) X-Gm-Message-State: AOAM5320w0VQGi1fhxglI0VLIEebhGnCWmdl1epDIyaj7EZOy4RcvVnn JqrNANloXaUxETqq9r612BrxacX6usOTUSHN44w= X-Received: by 2002:ac2:5683:: with SMTP id 3mr13234373lfr.69.1595914929714; Mon, 27 Jul 2020 22:42:09 -0700 (PDT) MIME-Version: 1.0 References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-26-guro@fb.com> In-Reply-To: <20200727184506.2279656-26-guro@fb.com> From: Song Liu Date: Mon, 27 Jul 2020 22:41:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2 25/35] bpf: eliminate rlimit-based memory accounting for socket storage 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:26 PM Roman Gushchin wrote: > > Do not use rlimit-based memory accounting for socket storage maps. > It has been replaced with the memcg-based memory accounting. > > Signed-off-by: Roman Gushchin Acked-by: Song Liu > --- > net/core/bpf_sk_storage.c | 11 ----------- > 1 file changed, 11 deletions(-) > > diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c > index fbcd03cd00d3..c0a35b6368af 100644 > --- a/net/core/bpf_sk_storage.c > +++ b/net/core/bpf_sk_storage.c > @@ -676,8 +676,6 @@ static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr) > struct bpf_sk_storage_map *smap; > unsigned int i; > u32 nbuckets; > - u64 cost; > - int ret; > > smap = kzalloc(sizeof(*smap), GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT); > if (!smap) > @@ -688,18 +686,9 @@ static struct bpf_map *bpf_sk_storage_map_alloc(union bpf_attr *attr) > /* Use at least 2 buckets, select_bucket() is undefined behavior with 1 bucket */ > nbuckets = max_t(u32, 2, nbuckets); > smap->bucket_log = ilog2(nbuckets); > - cost = sizeof(*smap->buckets) * nbuckets + sizeof(*smap); > - > - ret = bpf_map_charge_init(&smap->map.memory, cost); > - if (ret < 0) { > - kfree(smap); > - return ERR_PTR(ret); > - } > - > smap->buckets = kvcalloc(sizeof(*smap->buckets), nbuckets, > GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT); > if (!smap->buckets) { > - bpf_map_charge_finish(&smap->map.memory); > kfree(smap); > return ERR_PTR(-ENOMEM); > } > -- > 2.26.2 >