bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: <bpf@vger.kernel.org>
Cc: <netdev@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, <kernel-team@fb.com>,
	<linux-kernel@vger.kernel.org>, Roman Gushchin <guro@fb.com>
Subject: [PATCH bpf-next v2 35/35] perf: don't touch RLIMIT_MEMLOCK
Date: Mon, 27 Jul 2020 11:45:06 -0700	[thread overview]
Message-ID: <20200727184506.2279656-36-guro@fb.com> (raw)
In-Reply-To: <20200727184506.2279656-1-guro@fb.com>

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 <guro@fb.com>
---
 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 <api/fs/tracing_path.h>
 #include <bpf/bpf.h>
 #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 <subcmd/parse-options.h>
 #include "string2.h"
 #include "symbol.h"
-#include "util/rlimit.h"
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <subcmd/exec-cmd.h>
@@ -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 <sys/time.h>
-#include <sys/resource.h>
-
-/*
- * 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_
-- 
2.26.2


  parent reply	other threads:[~2020-07-27 18:46 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 18:44 [PATCH bpf-next v2 00/35] bpf: switch to memcg-based memory accounting Roman Gushchin
2020-07-27 18:44 ` [PATCH bpf-next v2 01/35] bpf: memcg-based memory accounting for bpf progs Roman Gushchin
2020-07-27 22:11   ` Song Liu
2020-07-28  0:08     ` Roman Gushchin
2020-07-28  4:42       ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 02/35] bpf: memcg-based memory accounting for bpf maps Roman Gushchin
2020-07-27 22:12   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 03/35] bpf: refine memcg-based memory accounting for arraymap maps Roman Gushchin
2020-07-27 22:30   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 04/35] bpf: refine memcg-based memory accounting for cpumap maps Roman Gushchin
2020-07-27 22:48   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 05/35] bpf: memcg-based memory accounting for cgroup storage maps Roman Gushchin
2020-07-27 23:05   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 06/35] bpf: refine memcg-based memory accounting for devmap maps Roman Gushchin
2020-07-27 23:35   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 07/35] bpf: refine memcg-based memory accounting for hashtab maps Roman Gushchin
2020-07-27 23:36   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 08/35] bpf: memcg-based memory accounting for lpm_trie maps Roman Gushchin
2020-07-27 23:55   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 09/35] bpf: memcg-based memory accounting for bpf ringbuffer Roman Gushchin
2020-07-27 23:56   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 10/35] bpf: memcg-based memory accounting for socket storage maps Roman Gushchin
2020-07-27 23:57   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 11/35] bpf: refine memcg-based memory accounting for sockmap and sockhash maps Roman Gushchin
2020-07-27 23:58   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 12/35] bpf: refine memcg-based memory accounting for xskmap maps Roman Gushchin
2020-07-28  0:01   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 13/35] bpf: eliminate rlimit-based memory accounting for arraymap maps Roman Gushchin
2020-07-28  0:04   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 14/35] bpf: eliminate rlimit-based memory accounting for bpf_struct_ops maps Roman Gushchin
2020-07-28  5:29   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 15/35] bpf: eliminate rlimit-based memory accounting for cpumap maps Roman Gushchin
2020-07-28  5:30   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 16/35] bpf: eliminate rlimit-based memory accounting for cgroup storage maps Roman Gushchin
2020-07-28  5:31   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 17/35] bpf: eliminate rlimit-based memory accounting for devmap maps Roman Gushchin
2020-07-28  5:31   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 18/35] bpf: eliminate rlimit-based memory accounting for hashtab maps Roman Gushchin
2020-07-28  5:32   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 19/35] bpf: eliminate rlimit-based memory accounting for lpm_trie maps Roman Gushchin
2020-07-28  5:32   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 20/35] bpf: eliminate rlimit-based memory accounting for queue_stack_maps maps Roman Gushchin
2020-07-28  5:35   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 21/35] bpf: eliminate rlimit-based memory accounting for reuseport_array maps Roman Gushchin
2020-07-28  5:36   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 22/35] bpf: eliminate rlimit-based memory accounting for bpf ringbuffer Roman Gushchin
2020-07-28  5:37   ` Song Liu
2020-07-28  5:56   ` Andrii Nakryiko
2020-07-27 18:44 ` [PATCH bpf-next v2 23/35] bpf: eliminate rlimit-based memory accounting for sockmap and sockhash maps Roman Gushchin
2020-07-28  5:37   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 24/35] bpf: eliminate rlimit-based memory accounting for stackmap maps Roman Gushchin
2020-07-28  5:38   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 25/35] bpf: eliminate rlimit-based memory accounting for socket storage maps Roman Gushchin
2020-07-28  5:41   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 26/35] bpf: eliminate rlimit-based memory accounting for xskmap maps Roman Gushchin
2020-07-28  5:42   ` Song Liu
2020-07-27 18:44 ` [PATCH bpf-next v2 27/35] bpf: eliminate rlimit-based memory accounting infra for bpf maps Roman Gushchin
2020-07-28  5:47   ` Song Liu
2020-07-28  5:58     ` Andrii Nakryiko
2020-07-28  6:06       ` Song Liu
2020-07-28 19:08         ` Roman Gushchin
2020-07-28 19:16           ` Andrii Nakryiko
2020-07-27 18:44 ` [PATCH bpf-next v2 28/35] bpf: eliminate rlimit-based memory accounting for bpf progs Roman Gushchin
2020-07-28  5:55   ` Song Liu
2020-07-27 18:45 ` [PATCH bpf-next v2 29/35] bpf: libbpf: cleanup RLIMIT_MEMLOCK usage Roman Gushchin
2020-07-27 22:05   ` Andrii Nakryiko
2020-07-27 22:44     ` Song Liu
2020-07-27 23:15     ` Roman Gushchin
2020-07-28  5:59       ` Andrii Nakryiko
2020-07-30  1:38         ` Roman Gushchin
2020-07-30 19:39           ` Andrii Nakryiko
2020-07-30 20:46             ` Roman Gushchin
2020-07-27 18:45 ` [PATCH bpf-next v2 30/35] bpf: bpftool: do not touch RLIMIT_MEMLOCK Roman Gushchin
2020-07-28  6:00   ` Song Liu
2020-07-28  6:00   ` Andrii Nakryiko
2020-07-27 18:45 ` [PATCH bpf-next v2 31/35] bpf: runqslower: don't " Roman Gushchin
2020-07-28  6:03   ` Andrii Nakryiko
2020-07-27 18:45 ` [PATCH bpf-next v2 32/35] bpf: selftests: delete bpf_rlimit.h Roman Gushchin
2020-07-28  6:06   ` Andrii Nakryiko
2020-07-28  6:11     ` Song Liu
2020-07-28 18:30       ` Andrii Nakryiko
2020-07-27 18:45 ` [PATCH bpf-next v2 33/35] bpf: selftests: don't touch RLIMIT_MEMLOCK Roman Gushchin
2020-07-28  6:08   ` Andrii Nakryiko
2020-07-27 18:45 ` [PATCH bpf-next v2 34/35] bpf: samples: do not " Roman Gushchin
2020-07-28  6:14   ` Song Liu
2020-07-27 18:45 ` Roman Gushchin [this message]
2020-07-28  6:09   ` [PATCH bpf-next v2 35/35] perf: don't " Andrii Nakryiko
2020-07-28 12:13     ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200727184506.2279656-36-guro@fb.com \
    --to=guro@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).