Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5080354pjb; Mon, 27 Jul 2020 12:24:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj6sbaW6ZI5+rDYZWYQ/vWMAZhMo/WpR4yw8kZH/9kkHYAMcnGKXpj5epBgy7EzDgIf6ZS X-Received: by 2002:a17:906:1f53:: with SMTP id d19mr22093659ejk.327.1595877898546; Mon, 27 Jul 2020 12:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595877898; cv=none; d=google.com; s=arc-20160816; b=Am7EzdJcJjgmVkxtFlAkMxeMCk9h6g48FOI3EHc5hi1PTuLMbZB9X8rEvRulYEqsaE D23JJn2gaLTu365bKUoay08HDSAuSuNVMMHxuXS16QZABD9temhSJG+CqTm3qwaPD2AI V+16RlEBLl+Nx9RLqzXb9RLnJ/czSMDgOCSxUctQwv6Vdo7lvM+7bCWAyHKe6CQ8dDML 5265IggyHIjs34AhGk/MhMtZXG5aPAkqYPRrX2KGeXJ7okr+C9LzngG5cCfS8VKsufzk QVy9YD805LiLEdwvoPyWmsmU8xBNPoBIoRI5mRToMPveq+8crD96hYX7NDkVxjA5inxY e/mA== 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=17orusyypan1KZmM80SiA8fbOfmJg8G/0LrmIpYnCe0=; b=DsaHu+8PUKv0GbTY3KFaCblSt/55KwjB80XE/lz8DyEQ59923NYubAhriQaNI6OLHq K0sXSCosl4hGy3VP3zV5kmNdbkwfJS1A4ocb1HUBTqAwiUQcqqvfJ2HiTr611G3fBQGs sDQbWHGWJUYAso5ktq1ccL/d+UWRO+5R/94mn+tMp7GCbO6ioz6ZNoODspXkJLj8UnOS 6zrQhAUUGejniZAkoSZqobZ9gSF40roReBHNhPw6MSNHns4FexHqWLJ27Q9z3hHUOKb1 WoGowpiCc0D/PX6RtPLcOEN8QKbDBQXvdb8o8xBbT6q0HzB4OUi8XFoO7GIceCx4SjMJ hVhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=O5g2Nqzk; 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 ss14si5084340ejb.651.2020.07.27.12.24.35; Mon, 27 Jul 2020 12:24:58 -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=O5g2Nqzk; 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 S1730309AbgG0Sq2 (ORCPT + 99 others); Mon, 27 Jul 2020 14:46:28 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38304 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732097AbgG0Spx (ORCPT ); Mon, 27 Jul 2020 14:45:53 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06RIjgAO027137 for ; Mon, 27 Jul 2020 11:45:52 -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=17orusyypan1KZmM80SiA8fbOfmJg8G/0LrmIpYnCe0=; b=O5g2NqzkW7YQgOEgMzM/5RZV38PmlJE8pnai0uP2KaWkDKbFPT1N+Vb1e1wasrAY9o0Y 1MUd3+onHTuIY71YgASVYdSWZt3GUCGJgwFaf6yS2JyB7DK6m4Y/oI9+/lYs3WluyHqJ YBqK79+VL0zablofleOP7gKROSuXmlke4hY= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 32h50vnsxu-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2020 11:45:52 -0700 Received: from intmgw004.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 27 Jul 2020 11:45:22 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id 989D21DAFE77; Mon, 27 Jul 2020 11:45:10 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm1096.prn0.facebook.com To: CC: , Alexei Starovoitov , Daniel Borkmann , , , Roman Gushchin Smtp-Origin-Cluster: prn0c01 Subject: [PATCH bpf-next v2 03/35] bpf: refine memcg-based memory accounting for arraymap maps Date: Mon, 27 Jul 2020 11:44:34 -0700 Message-ID: <20200727184506.2279656-4-guro@fb.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200727184506.2279656-1-guro@fb.com> References: <20200727184506.2279656-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-27_13:2020-07-27,2020-07-27 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 suspectscore=38 phishscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 malwarescore=0 bulkscore=0 mlxlogscore=911 priorityscore=1501 adultscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270127 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 --- 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