From patchwork Mon Jul 27 18:45:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 1337174 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=fb.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=fb.com header.i=@fb.com header.a=rsa-sha256 header.s=facebook header.b=LVgXSAU5; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BFpfd0fQCz9sSn for ; Tue, 28 Jul 2020 04:46:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732166AbgG0Sp7 (ORCPT ); Mon, 27 Jul 2020 14:45:59 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:4680 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732130AbgG0Sp6 (ORCPT ); Mon, 27 Jul 2020 14:45:58 -0400 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06RIiMsB009832 for ; Mon, 27 Jul 2020 11:45:57 -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=tOTnKQ9hJ/6vyBiLFhDflnCJN3o7B64H4g4vYAd3Q5c=; b=LVgXSAU53KXF78qUM6C8wHDIXnH6ytSFvFqJzC3bsWfPUsmUDq5Q7IgFnKpG7HkwpNVf TfoLnBQTABJqjFG+lln1tqaPJ4p3ybs2/vGjQ2CStjoltvNlUM2rryqVUSeQA/pYIfrR PUrvVd3X86ng4uwU/7fTqL814Vh7teUuNJI= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 32gj8kga7d-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2020 11:45:57 -0700 Received: from intmgw004.06.prn3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::5) 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 451681DAFEB7; Mon, 27 Jul 2020 11:45:11 -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 35/35] perf: don't touch RLIMIT_MEMLOCK Date: Mon, 27 Jul 2020 11:45:06 -0700 Message-ID: <20200727184506.2279656-36-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 X-FB-Internal: Safe 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 adultscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 suspectscore=13 bulkscore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270127 X-FB-Internal: deliver Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Since bpf stopped using memlock rlimit to limit the memory usage, there is no more reason for perf to alter its own limit. Signed-off-by: Roman Gushchin --- tools/perf/builtin-trace.c | 10 ---------- tools/perf/tests/builtin-test.c | 6 ------ tools/perf/util/Build | 1 - tools/perf/util/rlimit.c | 29 ----------------------------- tools/perf/util/rlimit.h | 6 ------ 5 files changed, 52 deletions(-) delete mode 100644 tools/perf/util/rlimit.c delete mode 100644 tools/perf/util/rlimit.h diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 4cbb64edc998..3d6a98a12537 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -19,7 +19,6 @@ #include #include #include "util/bpf_map.h" -#include "util/rlimit.h" #include "builtin.h" #include "util/cgroup.h" #include "util/color.h" @@ -4838,15 +4837,6 @@ int cmd_trace(int argc, const char **argv) goto out; } - /* - * Parsing .perfconfig may entail creating a BPF event, that may need - * to create BPF maps, so bump RLIM_MEMLOCK as the default 64K setting - * is too small. This affects just this process, not touching the - * global setting. If it fails we'll get something in 'perf trace -v' - * to help diagnose the problem. - */ - rlimit__bump_memlock(); - err = perf_config(trace__config, &trace); if (err) goto out; diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index da5b6cc23f25..e4efbba8202b 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -22,7 +22,6 @@ #include #include "string2.h" #include "symbol.h" -#include "util/rlimit.h" #include #include #include @@ -794,11 +793,6 @@ int cmd_test(int argc, const char **argv) if (skip != NULL) skiplist = intlist__new(skip); - /* - * Tests that create BPF maps, for instance, need more than the 64K - * default: - */ - rlimit__bump_memlock(); return __cmd_test(argc, argv, skiplist); } diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 8d18380ecd10..4902cd3b3b58 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -26,7 +26,6 @@ perf-y += parse-events.o perf-y += perf_regs.o perf-y += path.o perf-y += print_binary.o -perf-y += rlimit.o perf-y += argv_split.o perf-y += rbtree.o perf-y += libstring.o diff --git a/tools/perf/util/rlimit.c b/tools/perf/util/rlimit.c deleted file mode 100644 index 13521d392a22..000000000000 --- a/tools/perf/util/rlimit.c +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1 */ - -#include "util/debug.h" -#include "util/rlimit.h" -#include -#include - -/* - * Bump the memlock so that we can get bpf maps of a reasonable size, - * like the ones used with 'perf trace' and with 'perf test bpf', - * improve this to some specific request if needed. - */ -void rlimit__bump_memlock(void) -{ - struct rlimit rlim; - - if (getrlimit(RLIMIT_MEMLOCK, &rlim) == 0) { - rlim.rlim_cur *= 4; - rlim.rlim_max *= 4; - - if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) { - rlim.rlim_cur /= 2; - rlim.rlim_max /= 2; - - if (setrlimit(RLIMIT_MEMLOCK, &rlim) < 0) - pr_debug("Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc\n"); - } - } -} diff --git a/tools/perf/util/rlimit.h b/tools/perf/util/rlimit.h deleted file mode 100644 index 9f59d8e710a3..000000000000 --- a/tools/perf/util/rlimit.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __PERF_RLIMIT_H_ -#define __PERF_RLIMIT_H_ -/* SPDX-License-Identifier: LGPL-2.1 */ - -void rlimit__bump_memlock(void); -#endif // __PERF_RLIMIT_H_