Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2245514ybg; Thu, 30 Jul 2020 14:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI6ZKet4FlMhLhoxD9amEOMyWSV0PrkXc34BbWkyOx46OKamf4fKpFR1G7RUt/sFxzRq18 X-Received: by 2002:a50:ccd0:: with SMTP id b16mr996448edj.148.1596144622945; Thu, 30 Jul 2020 14:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596144622; cv=none; d=google.com; s=arc-20160816; b=uICHJtoeKIsuv6xiedfT0HYdGGXi5oD9oJQUqPdJq6uxGEsEVfwG0/AZHPx1Fz6Mpl 5jvL1HD2cMByXISlBO+dEbDA+XizutPhIbwpi7tf8tyI/SKQE9wJLTiUgWpNelxtVdro FNuZ906Larzrmuw7/DRM6FW5NHVvrX+0ZqV9Ozhhde4h6PxIk+g2h1WwJlAMJBiJzIY2 uF0f/w62YLhTbnavwL0D2LKpP+nFSTfUOFLiN1Wdfbafn/NdRMv751bHBdlkDsSENAW6 /R8+yQR0xxyv/0+zxEPpub3uzRUanHNX+z52VJDovmgl/vD8Lt4LyESj3e7DgoGNz+a1 drAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:smtp-origin-cluster :cc:to:smtp-origin-hostname:from:smtp-origin-hostprefix :dkim-signature; bh=++GOQs6OyBg0NRpfI9Y2G3lb6tt1keWKXcgXu1XREmo=; b=zMJ1h//sHjYIWpomq2E02d2LCEZgdQeKbpu2q/Mj21///CrOLxbbfCaCwKbTP0kxio 5NN6mTavsMIvKuvWrZNz/WnOV6zoDwmB4KzrPuBhmoFKtJDPnjR47kS6E8auu+WI7W0r uXPt9Xk7qZNfodKliO/XMRfl2gymdrDnSVf0wkO0vANtWXhZbnuASD1+dOMsCIr/ytec sqRgiW23K+Kc55o+AF3HbtxrGnwmxXGkWxWGW8N3S0lSNZoOfdFAJG2ERc3srfP+GN+r M8uiShXmV9Jb4bN6MUzIhox1LF7YH2fPIA54kU1f0r4FN0VSyVgkPmxyWVpaPnX6nEL6 mujQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=UyQYWYtD; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq9si3969009ejb.442.2020.07.30.14.30.00; Thu, 30 Jul 2020 14:30:22 -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=@fb.com header.s=facebook header.b=UyQYWYtD; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730648AbgG3VXR (ORCPT + 99 others); Thu, 30 Jul 2020 17:23:17 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:59738 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730571AbgG3VXQ (ORCPT ); Thu, 30 Jul 2020 17:23:16 -0400 Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06ULGPh3004912 for ; Thu, 30 Jul 2020 14:23:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=++GOQs6OyBg0NRpfI9Y2G3lb6tt1keWKXcgXu1XREmo=; b=UyQYWYtD8I1Gq9MEbFHDXc3qiUaNabI+bN4UNQEFJueLaOxPH335/acYtqI1dDSN+Y+S kornGtEWO3vyoz9XPQ3XeLIIlvcKi7HDzuCLKtRK6ymFZeBRkFskw7m472VqtWWQTs4Z QMJyiE7YkRYQgWbI69+1kcyFqhFHXGfSBM8= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com with ESMTP id 32m4kxrfu5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2020 14:23:15 -0700 Received: from intmgw002.41.prn1.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c085:11d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 30 Jul 2020 14:23:14 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id 9EA9020B00A0; Thu, 30 Jul 2020 14:23:12 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm1096.prn0.facebook.com To: CC: , Alexei Starovoitov , Daniel Borkmann , , , Roman Gushchin , Song Liu Smtp-Origin-Cluster: prn0c01 Subject: [PATCH bpf-next v3 03/29] bpf: refine memcg-based memory accounting for arraymap maps Date: Thu, 30 Jul 2020 14:22:44 -0700 Message-ID: <20200730212310.2609108-4-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200730212310.2609108-1-guro@fb.com> References: <20200730212310.2609108-1-guro@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-30_15:2020-07-30,2020-07-30 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 suspectscore=38 mlxlogscore=929 malwarescore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007300150 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Include percpu arrays and auxiliary data into the memcg-based memory accounting. Signed-off-by: Roman Gushchin Acked-by: Song Liu --- kernel/bpf/arraymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index 8ff419b632a6..9597fecff8da 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -28,12 +28,12 @@ static void bpf_array_free_percpu(struct bpf_array *a= rray) =20 static int bpf_array_alloc_percpu(struct bpf_array *array) { + const gfp_t gfp =3D GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT; void __percpu *ptr; int i; =20 for (i =3D 0; i < array->map.max_entries; i++) { - ptr =3D __alloc_percpu_gfp(array->elem_size, 8, - GFP_USER | __GFP_NOWARN); + ptr =3D __alloc_percpu_gfp(array->elem_size, 8, gfp); if (!ptr) { bpf_array_free_percpu(array); return -ENOMEM; @@ -969,7 +969,7 @@ static struct bpf_map *prog_array_map_alloc(union bpf= _attr *attr) struct bpf_array_aux *aux; struct bpf_map *map; =20 - aux =3D kzalloc(sizeof(*aux), GFP_KERNEL); + aux =3D kzalloc(sizeof(*aux), GFP_KERNEL_ACCOUNT); if (!aux) return ERR_PTR(-ENOMEM); =20 --=20 2.26.2