Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp568678ybg; Tue, 28 Jul 2020 13:02:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7URhUA7flf8pPs+6N98l/gVwAGJEe3zmMPTw6jWEjQ6rQVnbJPaKTy+k3L4CuKn54JOyZ X-Received: by 2002:a17:906:a1cc:: with SMTP id bx12mr25791056ejb.461.1595966579538; Tue, 28 Jul 2020 13:02:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1595966579; cv=pass; d=google.com; s=arc-20160816; b=QimnDMHilfEHugm/VCKcx0XrdCd7dnwTcxlltlzuda96oaHQVrAitecFOU12HgDdS3 yyinso5rT20Eofkfs+cwaUKVGFQkBa7y4fqBCJJyszRRrW0CyslRahYgTSINDEj93vzW iwztTbbcbE/+sxM1KlOjE0IQzuXRsmIgY6DLjBUA3Sr1YAiXHLJHxmZnHPdkGIikoeMY hc/A+HuXLn9AeTu18zfznSfIPQmWR+Tdf8MVviyWo69r+R8mR4Bf9WoKqkTKKSK3JQt3 J2RBey5ysFsbEzZ96BKkA00VYfhVdvDkKbj66X4bADa8iK+LkbgYbA+seanvEQRaqpvc SmSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to :content-disposition:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=RqMH5FgmY1F/t9obTYlspT62XZJDOpDJ7tAbgJXsE8I=; b=DrS30iBFo80eNslqAjJbGgo7KBhTmZEufoL1JQbsZjOBsVdsqXXlgWqaoNix1AikK0 1wISKoM1DwAXV3nCjW2YX/ExGVDnRfbVZEfS59r4PAKiyx2HI3YtcO4d+1eKkcw1K/wX 2iVguN+TjW1TyaIqM8FV5su0VVXo6SENB+bfmdTxbOJjLmW4FxjPc6Z8B8H0gXdWs1kq AXmTSbmzX7wCjLOCGlGv3wOgMu/HNvzLTfljV7G3EUL9a714pBTG2p9trPBMeMKzdSKM os6vOe9+ZWn9uokpyIPkmWMzkXe6hYa3Z9nfzy8pDRSm31IGgbDjX3vtoW3Xt7Z8Cv71 fRBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=EWGZyPdq; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=E0163DWE; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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 y24si5389769eds.240.2020.07.28.13.02.37; Tue, 28 Jul 2020 13:02:59 -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=EWGZyPdq; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=E0163DWE; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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 S1732611AbgG1TJU (ORCPT + 99 others); Tue, 28 Jul 2020 15:09:20 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38532 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728978AbgG1TJT (ORCPT ); Tue, 28 Jul 2020 15:09:19 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06SJ8Q8L008826; Tue, 28 Jul 2020 12:09:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=facebook; bh=RqMH5FgmY1F/t9obTYlspT62XZJDOpDJ7tAbgJXsE8I=; b=EWGZyPdqCZ288D9C+LBN0g3QYTdz2AAiK0zbN41++kEwGHwSSINgY9Ktc1Tz50ZaGvlU 3x+6o0Hvy4AAgiJoFOxfYwdfct+OmYpQz0rXtZJLSLvQDBUIP3P1+UgV45cSbcMK97nH f4NN5LpR1V+HbGFc24dTtqDAeQ8m1BxJj4Y= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 32h4qs39m6-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 28 Jul 2020 12:09:05 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (100.104.31.183) by o365-in.thefacebook.com (100.104.36.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 28 Jul 2020 12:08:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2EtBXBqVDku3F9PZMVxlTs0jSplPO35UQQbHW5oMS6eIImcQUR4X0mRRknSMkSSwr3jyffT0LzqgebqStemvonu1kzODtRvBoPoe/QE7goiYi7MdnCsr4Qrk5uIixmreFIlca9yOdQjpEIy/gAAY5vPTUqqWOEx/A39/1LWW9XI+WZJPtNpHRD1H0WQfhBu05I3wLlDyEXaVhIClYcPjxoM0aeV1bKJWvZjbE/nktQp+h8pkS21ESafMy8NRI0lgRxEUVbasHHfb3y/cePAGr8syT3aH0rtF5INna30IcorhzcJM3A8xrESHYy+2b4u0+aTow0U/5g1OnYKbUhHMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RqMH5FgmY1F/t9obTYlspT62XZJDOpDJ7tAbgJXsE8I=; b=aMIaDPl7AJ5Cak3slndsKcK6Xk/Z8vLsKl4Scvsy0SlhxN0lBLPqheCYusQwWvwamvraVfFfBbuhEVHj9WtYiCOU0G3ZXVDWY1Pp/AEzTBfU+2KgR2tT7yyoHfBRKGKtfht6SxyvkSu66bPYV0PDsnKV4SOpC/CSztNXVzS8XfvkbJYYrWmjsSmEit5HK94Spg/II7/5FNgN1cuwG9wFPASQWw8t/CAhK+NZmRVKpWtFqfijq2dcwbje9qbtf6NB9RJNd5wWy+wAuITsrc01xHl8ySTI96yEKfKK35tnrp522/PipdWwjv99zK3mLXkxuPmWVf+Bhh9adYEQqqDFEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector2-fb-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RqMH5FgmY1F/t9obTYlspT62XZJDOpDJ7tAbgJXsE8I=; b=E0163DWEfW7rBl0g66VNN/c1d1xYnCDJpW3SKsl+cEniDM3y+tKtp46lMmmbkR1D++8K8sp4fMwnkaslSVa0SHYxMwjqKCzP1yxkvEJsqOK3+kNibEdb9VCOdHFSLHZS4MawKT+jSei/9aqs8/lE0u9z8pli4U3DbwPanSlancw= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=fb.com; Received: from BYAPR15MB4136.namprd15.prod.outlook.com (2603:10b6:a03:96::24) by BYAPR15MB3128.namprd15.prod.outlook.com (2603:10b6:a03:b3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Tue, 28 Jul 2020 19:08:33 +0000 Received: from BYAPR15MB4136.namprd15.prod.outlook.com ([fe80::48e3:c159:703d:a2f1]) by BYAPR15MB4136.namprd15.prod.outlook.com ([fe80::48e3:c159:703d:a2f1%5]) with mapi id 15.20.3216.033; Tue, 28 Jul 2020 19:08:33 +0000 Date: Tue, 28 Jul 2020 12:08:30 -0700 From: Roman Gushchin To: Song Liu CC: Andrii Nakryiko , bpf , Networking , Alexei Starovoitov , Daniel Borkmann , Kernel Team , open list Subject: Re: [PATCH bpf-next v2 27/35] bpf: eliminate rlimit-based memory accounting infra for bpf maps Message-ID: <20200728190830.GB410810@carbon.DHCP.thefacebook.com> References: <20200727184506.2279656-1-guro@fb.com> <20200727184506.2279656-28-guro@fb.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: BYAPR07CA0059.namprd07.prod.outlook.com (2603:10b6:a03:60::36) To BYAPR15MB4136.namprd15.prod.outlook.com (2603:10b6:a03:96::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from carbon.DHCP.thefacebook.com (2620:10d:c090:400::5:19ed) by BYAPR07CA0059.namprd07.prod.outlook.com (2603:10b6:a03:60::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Tue, 28 Jul 2020 19:08:32 +0000 X-Originating-IP: [2620:10d:c090:400::5:19ed] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b9afbfc-294f-4c1e-b02b-08d833299f0d X-MS-TrafficTypeDiagnostic: BYAPR15MB3128: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-FB-Source: Internal X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nBdzl0adiZf9YJRu1a4G81jIs//5LaJn4L9us2enTXYytkXZfVOS24rKZMJxyo+fnab72BpLPHkM4vFq/e4nZfmBFW4NVi5XhyHaUUMYXiNQQZsOpJfhVBCCUUvJPVY8CTMEr8nB8NMifjKazz490P4JAHBBXK+5cW6dEW5XNEgNHAkNfoSVV/6kjXpl/3M9mf6iAPsqT47/ll4HHhtdeFcFnv/Rj0gs3Koz6wUxgwnEkxMUIKsS3a3tqCrDY0lcJ0Gc0mdmkGrVRO5+Wb29gbVGmeAhHWftYKJm4NauOyE0mbP521CCiv9KheV4zyNnUDxdcvpTA0Glt+95mof+jw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR15MB4136.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(376002)(346002)(396003)(366004)(136003)(39860400002)(316002)(33656002)(2906002)(83380400001)(4326008)(7696005)(54906003)(53546011)(52116002)(15650500001)(16526019)(186003)(6506007)(478600001)(5660300002)(86362001)(66946007)(66556008)(6916009)(1076003)(66476007)(9686003)(8936002)(8676002)(55016002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wowWe5JNXetmYsc0FRyMdagGQyKJeCjmgZ7gr9D7i6VEPh85vfFVMMq5wlPxnXLWx/k8T7XjzE5/b+j2beUiIAeyVgFi7vzO2O7Hjr5eU7syDdpXA31OWCOYPupJY65ECVkM78IRlIraqUp/fw5P+Rzip++liguqELEl4utADVFBIJHtQL2FbQPcKpwbDnIaxUYFSPWz2fH93EyhXTSAbAvFQ5lVOOeYTWOEwgSG6tPal39vyc0s3Oom5Afoz27Olg53coN4z6hN6M0PyRG/4H74vxOwkVe7dFvuaI8Bip6/sDA1Wn6CVPiOU5Fkv5dO+nygHL7/1yTI5vxRSUNuyC4P3+Js/3BhqUXrJQ3KZR61ZLn8cFTrkOxqiEBE56a4R5ruQ2ewx+rXa3ifSWa4hPQkJ01ueDnFiER/NXBMUFknxEoITbNlM29WoAgp6ze0UZQpmfYdm/IYIlg5QKFf5eyK5bEQCuJ4KXE7uzTnIwdrOQzYQKT63zHBPHQQpqD3PIiwRCRcs6H4X7rWSqHvcg== X-MS-Exchange-CrossTenant-Network-Message-Id: 1b9afbfc-294f-4c1e-b02b-08d833299f0d X-MS-Exchange-CrossTenant-AuthSource: BYAPR15MB4136.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2020 19:08:32.9114 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VET0SkMlTt/ZSnDAz0ndkJR8ChS/WgUdrzD7JmnRlLacP3vs49pvPRMtaUTzbZOX X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR15MB3128 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-28_15:2020-07-28,2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 mlxscore=0 priorityscore=1501 spamscore=0 bulkscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=1 malwarescore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007280136 X-FB-Internal: deliver 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 11:06:42PM -0700, Song Liu wrote: > On Mon, Jul 27, 2020 at 10:58 PM Andrii Nakryiko > wrote: > > > > On Mon, Jul 27, 2020 at 10:47 PM Song Liu wrote: > > > > > > On Mon, Jul 27, 2020 at 12:26 PM Roman Gushchin wrote: > > > > > > > > Remove rlimit-based accounting infrastructure code, which is not used > > > > anymore. > > > > > > > > Signed-off-by: Roman Gushchin > > > [...] > > > > > > > > static void bpf_map_put_uref(struct bpf_map *map) > > > > @@ -541,7 +484,7 @@ static void bpf_map_show_fdinfo(struct seq_file *m, struct file *filp) > > > > "value_size:\t%u\n" > > > > "max_entries:\t%u\n" > > > > "map_flags:\t%#x\n" > > > > - "memlock:\t%llu\n" > > > > + "memlock:\t%llu\n" /* deprecated */ > > > > > > I am not sure whether we can deprecate this one.. How difficult is it > > > to keep this statistics? > > > > > > > It's factually correct now, that BPF map doesn't use any memlock memory, no? Right. > > I am not sure whether memlock really means memlock for all users... I bet there > are users who use memlock to check total memory used by the map. But this is just the part of struct bpf_map, so I agree with Andrii, it's a safe check. > > > > > This is actually one way to detect whether RLIMIT_MEMLOCK is necessary > > or not: create a small map, check if it's fdinfo has memlock: 0 or not > > :) > > If we do show memlock=0, this is a good check... The only question I have if it's worth checking at all? Bumping the rlimit is a way cheaper operation than creating a temporarily map and checking its properties. So is there any win in comparison to just leaving the userspace code* as it is for now? * except runqslower and samples