From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796199071; b=1U5rOmlXOv5ruWXC7hj6eBidJs859IspC90TkYfBvTBpJr/xCY7ckETQndxvLW3Do1LX 5UBtHGfxtxIobvfVr23MqGElYvxtumhfy/6rgZiF6pEAyC85pjxIF5gT3fSR3rQmcewcL zf9Jk/2bIsLX6pCkPqbhjFYbhGP7WJnqqIBfGn4qt9ThtBrDPc5UStABbCmSSF9075DIY b3MY8QtSG9JcskT/vHdeWy8+fTuu2krU4S4bAMZOua1E5knwmHEuPYv6dGY0oUSUkXIsE 0z9Cumcx7ZqTyKv5Bd9VD89uguUG6270KkdKOyhWcl5tCpX0Pk63HB41ksK+GaCGeHw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796199071; h=Received:DKIM-Signature:Received:Message-ID:User-Agent:Date:From:To: Cc:Subject:References:MIME-Version:Content-Type; bh=pmBXOnOs538PzEsTBhWoE1sB1uhnPR3rGYaWXUHsvNY=; b=Lmx3NUHAyzSa6e1DVKK3Uyk1TGYT/YIpBu5osiL2hGdrz9LMW4YQcok9M6pWa26VhyBC 449ucIMBGRnoD7c1fcC39ClitkcDQJlXZ32dW2epEnceM0UQOr9796bGSOBzua/YkH2Fx 9pFaWOO90Odn1/TVPKaZ2Mp0OlpXCFB7SlsAEEhvWv3ZJbSHPli6LjwhLuVqqQuqTO6Si Dnxc1D6Xx+oBdRkpk91dSzc3GAS+s3o9be0FIlZgskSI0VRZkl9Eea4isBvzsA5tVWM/L ux+VSUp2Lp9M5CtLQhoBKidnOAFNPeajxCUJ0yKAoBp+a8GBgAFHkNICMPUhoZlzmbw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RHUluivK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D40A1606A322 for ; Wed, 2 Dec 2026 08:11:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RHUluivK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E37B1F00924; Wed, 2 Dec 2026 08:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796199071; bh=pmBXOnOs538PzEsTBhWoE1sB1uhnPR3rGYaWXUHsvNY=; h=Date:From:To:Cc:Subject:References; b=RHUluivKKFLGckDX/OJBHHeQ90M5le18jZmcFqjdtLy2kjuAS07fZesu35MPiULQl 9l6o1XFvr/f4ufsWPA5cmgP8RlrtzPyuu6WUVZfeFz0IxZ7rhGYwyicOY5YVUKZMfV vuPXXrltrS2rlSLOFO7FyIgfByaa55U+Q+WDvmWrJtuFVDSBUr1ea8z00XrqzPPW9C NPRiHujUksbJyGSbBCJpX9bRkUCnffN+lfSs89VmtXdGGd4nKgva9TJqfAB92yRHr8 NuBZ3ylj0a/3PXvxOV6IjAwNEhNjpcBqueIue81WJRexKuG7NPOFSoPIVJPEmtIS3K chDjGBeYVZ0pw== Received: from rostedt by gandalf with local (Exim 4.100.1) (envelope-from ) id 1xYfQk-0000000AEwR-2MUR; Wed, 02 Dec 2026 03:11:10 -0500 Message-ID: <20261202081110.366911409@kernel.org> User-Agent: quilt/0.69 Date: Wed, 02 Dec 2026 03:10:39 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mathieu Desnoyers , Vincent Donnefort Subject: [for-next][PATCH 1/3] ring-buffer: Use is_user_task() in __rb_allocate_pages() References: <20261202081038.604861818@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Vincent Donnefort 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 Signed-off-by: Vincent Donnefort Signed-off-by: Steven Rostedt --- 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