Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5082032pjb; Mon, 27 Jul 2020 12:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ07QevRm1HVRRknJyZst6UNfH+zEsa+WZzbDIaJHIEOoS4kCsLdRYdP/Qelm6fAyHx4zp X-Received: by 2002:a17:906:6558:: with SMTP id u24mr21457596ejn.364.1595878089254; Mon, 27 Jul 2020 12:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595878089; cv=none; d=google.com; s=arc-20160816; b=nyTQduotxXuzS73lA3nOEHdFWE8qEWD+dv4OYfnGwln7GMm2R/05XRtYRQgLRyyLo9 7QI9vOAawZYBn02HxeKsXvWe6NzShz/sfMQU+KlGKNrEUArHO38I1gJ2trxAShJbc0MR z7HdbyDd0DypcqAsfaSBNfZf8T6FnfW2XWslF3tSLMKvh6f1oRL1/qHtKiFadLefOtbs LLGoqDyrNLN0hzSUoK4yrc1+4rdbdEhx6X+4Il72GmWCeK3j4pQBZmMSNZBYwGv8Nw9y IM4PgMj4f4jwZuDuxuifW2E8ET5Ro3hxqr0InDdKleNDzjKbJo4Y5+0Xq11cfOrAoGJo z1Nw== 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=Vcb83+f74UvJlIacjBTHLSV5Z+RJgcds2HrEoDLq7rQ=; b=PMOT2yf2LEn4JVpclgt1aer8ShANt2aA5aCA06BcAvsBFNT9ba2ppoVZ64ljWOUDUZ Sg202W0aNk7QzHgmaM+wNpqgInh0+8he+4SFRay1VFL64ZX/PM3f81jeNfRyCdjcz7B1 NWeHV3mrLG+j9/KcpMnmgQNCNnDpLzaHIc+xyH6j0ZxJQyyyOMIYUD+SAPx39NoAut1p TV0dkM/lS8X2wCuZmIIZI3AZJqoSDAv4/uYve02yabcrhCr16wi4Uxq5tnfviU+GE7rw +Hq1MiYNjS3Yt6XugKN0SKc1/2REIndyVMAPLJGOmYSlZnBECULs6b6wL7SchE/MxH1w iDng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=pAGjg0sW; 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 dn20si9261420ejc.80.2020.07.27.12.27.47; Mon, 27 Jul 2020 12:28:09 -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=pAGjg0sW; 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 S1731666AbgG0SpV (ORCPT + 99 others); Mon, 27 Jul 2020 14:45:21 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:51924 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729015AbgG0SpR (ORCPT ); Mon, 27 Jul 2020 14:45:17 -0400 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06RIcv6H016654 for ; Mon, 27 Jul 2020 11:45:17 -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=Vcb83+f74UvJlIacjBTHLSV5Z+RJgcds2HrEoDLq7rQ=; b=pAGjg0sWm26270qVUARbmO1CevIgEWs96GihltrIT306PGhcGjQ8YZO8JVOM/poBoCnz 4j0M1mAiPLqF9BgnCXcF/yF+F2/Mh2SHrB0Cl3i6NBSkCZzNs2VczGHfLispghLwqp4F G4G+HDoVY3jAkVoKLKXQQTue56izQKirwdA= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 32h4q9dvj9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2020 11:45:17 -0700 Received: from intmgw001.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::e) 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:15 -0700 Received: by devvm1096.prn0.facebook.com (Postfix, from userid 111017) id A87171DAFE7D; 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 06/35] bpf: refine memcg-based memory accounting for devmap maps Date: Mon, 27 Jul 2020 11:44:37 -0700 Message-ID: <20200727184506.2279656-7-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 spamscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=867 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 suspectscore=13 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270126 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Include map metadata and the node size (struct bpf_dtab_netdev) on element update into the accounting. Signed-off-by: Roman Gushchin --- kernel/bpf/devmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 10abb06065bb..05bf93088063 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -175,7 +175,7 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *= attr) if (!capable(CAP_NET_ADMIN)) return ERR_PTR(-EPERM); =20 - dtab =3D kzalloc(sizeof(*dtab), GFP_USER); + dtab =3D kzalloc(sizeof(*dtab), GFP_USER | __GFP_ACCOUNT); if (!dtab) return ERR_PTR(-ENOMEM); =20 @@ -603,7 +603,8 @@ static struct bpf_dtab_netdev *__dev_map_alloc_node(s= truct net *net, struct bpf_prog *prog =3D NULL; struct bpf_dtab_netdev *dev; =20 - dev =3D kmalloc_node(sizeof(*dev), GFP_ATOMIC | __GFP_NOWARN, + dev =3D kmalloc_node(sizeof(*dev), + GFP_ATOMIC | __GFP_NOWARN | __GFP_ACCOUNT, dtab->map.numa_node); if (!dev) return ERR_PTR(-ENOMEM); --=20 2.26.2