From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Vincent Donnefort <vdonnefort@google.com>
Subject: [for-next][PATCH 1/3] ring-buffer: Use is_user_task() in __rb_allocate_pages()
Date: Wed, 02 Dec 2026 03:10:39 -0500 [thread overview]
Message-ID: <20261202081110.366911409@kernel.org> (raw)
In-Reply-To: 20261202081038.604861818@kernel.org
From: Vincent Donnefort <vdonnefort@google.com>
Before allocating ring buffer pages, __rb_allocate_pages() checks the
available memory with si_mem_available(). This is however only a rough
estimate and may report memory that can't be used for this allocation.
In the event of an OOM, we don't want to penalise another task with the
OOM killer, so the allocating thread is marked as the OOM origin when it
is a user task.
Checking current->mm is however not sufficient to distinguish user from
kernel tasks. Instead, use is_user_task().
Link: https://patch.msgid.link/20261016154707.2125747-1-vdonnefort@google.com
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index a5a0adc934fa..0377868a12c2 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2482,7 +2482,7 @@ static int __rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
if (i < (nr_pages << subbuf_order))
return -ENOMEM;
- user_thread = current->mm != NULL;
+ user_thread = is_user_task(current);
}
/*
--
2.53.0
next prev parent reply other threads:[~2026-12-02 8:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:10 [for-next][PATCH 0/3] ring-buffer: Updates for v7.5 Steven Rostedt
2026-12-02 8:10 ` Steven Rostedt [this message]
2026-12-02 8:10 ` [for-next][PATCH 2/3] ring-buffer: Mark concurrent accesses to waiter flags Steven Rostedt
2026-12-02 8:10 ` [for-next][PATCH 3/3] ring-buffer: Annotate the speculative iterator event copy Steven Rostedt
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=20261202081110.366911409@kernel.org \
--to=rostedt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=vdonnefort@google.com \
/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