linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: Consistently fail fork on allocation failures
@ 2019-11-05  7:57 Alexander Shishkin
  2019-11-13 10:06 ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shishkin @ 2019-11-05  7:57 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, linux-kernel, Jiri Olsa,
	Alexander Shishkin

Commit

  313ccb9615948 ("perf: Allocate context task_ctx_data for child event")

makes the inherit path skip over the current event in case of task_ctx_data
allocation failure. This, however, is inconsistent with allocation failures
in perf_event_alloc(), which would abort the fork.

Correct this by returning an error code on task_ctx_data allocation
failure and failing the fork in that case.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 8ff1218e91b1..c8203f1b2d20 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -12026,7 +12026,7 @@ inherit_event(struct perf_event *parent_event,
 						   GFP_KERNEL);
 		if (!child_ctx->task_ctx_data) {
 			free_event(child_event);
-			return NULL;
+			return ERR_PTR(-ENOMEM);
 		}
 	}
 
-- 
2.24.0.rc1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: perf/urgent] perf/core: Consistently fail fork on allocation failures
  2019-11-05  7:57 [PATCH] perf: Consistently fail fork on allocation failures Alexander Shishkin
@ 2019-11-13 10:06 ` tip-bot2 for Alexander Shishkin
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Alexander Shishkin @ 2019-11-13 10:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Alexander Shishkin, Peter Zijlstra (Intel),
	Arnaldo Carvalho de Melo, David Ahern, Jiri Olsa, Jiri Olsa,
	Linus Torvalds, Mark Rutland, Namhyung Kim, Stephane Eranian,
	Thomas Gleixner, Vince Weaver, Ingo Molnar, Borislav Petkov,
	linux-kernel

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     697d877849d4b34ab58d7078d6930bad0ef6fc66
Gitweb:        https://git.kernel.org/tip/697d877849d4b34ab58d7078d6930bad0ef6fc66
Author:        Alexander Shishkin <alexander.shishkin@linux.intel.com>
AuthorDate:    Tue, 05 Nov 2019 09:57:02 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 13 Nov 2019 08:16:43 +01:00

perf/core: Consistently fail fork on allocation failures

Commit:

  313ccb9615948 ("perf: Allocate context task_ctx_data for child event")

makes the inherit path skip over the current event in case of task_ctx_data
allocation failure. This, however, is inconsistent with allocation failures
in perf_event_alloc(), which would abort the fork.

Correct this by returning an error code on task_ctx_data allocation
failure and failing the fork in that case.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: https://lkml.kernel.org/r/20191105075702.60319-1-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7655441..466e333 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11802,7 +11802,7 @@ inherit_event(struct perf_event *parent_event,
 						   GFP_KERNEL);
 		if (!child_ctx->task_ctx_data) {
 			free_event(child_event);
-			return NULL;
+			return ERR_PTR(-ENOMEM);
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-13 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05  7:57 [PATCH] perf: Consistently fail fork on allocation failures Alexander Shishkin
2019-11-13 10:06 ` [tip: perf/urgent] perf/core: " tip-bot2 for Alexander Shishkin

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).