* [PATCH v2] trace/pid_list: Change gfp flags in pid_list_fill_irq()
@ 2024-07-04 15:02 Levi Yun
2024-07-05 14:11 ` Masami Hiramatsu
0 siblings, 1 reply; 2+ messages in thread
From: Levi Yun @ 2024-07-04 15:02 UTC (permalink / raw)
To: rostedt, mhiramat, mathieu.desnoyers
Cc: linux-kernel, linux-trace-kernel, levi.yun
From: "levi.yun" <yeoreum.yun@arm.com>
pid_list_fill_irq() runs via irq_work.
When CONFIG_PREEMPT_RT is disabled, it would run in irq_context.
so it shouldn't sleep while memory allocation.
Change gfp flags from GFP_KERNEL to GFP_NOWAIT to prevent sleep in
irq_work.
This change wouldn't impact functionality in practice because the worst-size
is 2K.
Signed-off-by: levi.yun <yeoreum.yun@arm.com>
---
kernel/trace/pid_list.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/pid_list.c b/kernel/trace/pid_list.c
index 95106d02b32d..85de221c0b6f 100644
--- a/kernel/trace/pid_list.c
+++ b/kernel/trace/pid_list.c
@@ -354,7 +354,7 @@ static void pid_list_refill_irq(struct irq_work *iwork)
while (upper_count-- > 0) {
union upper_chunk *chunk;
- chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
+ chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT);
if (!chunk)
break;
*upper_next = chunk;
@@ -365,7 +365,7 @@ static void pid_list_refill_irq(struct irq_work *iwork)
while (lower_count-- > 0) {
union lower_chunk *chunk;
- chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
+ chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT);
if (!chunk)
break;
*lower_next = chunk;
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] trace/pid_list: Change gfp flags in pid_list_fill_irq()
2024-07-04 15:02 [PATCH v2] trace/pid_list: Change gfp flags in pid_list_fill_irq() Levi Yun
@ 2024-07-05 14:11 ` Masami Hiramatsu
0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2024-07-05 14:11 UTC (permalink / raw)
To: Levi Yun; +Cc: rostedt, mathieu.desnoyers, linux-kernel, linux-trace-kernel
On Thu, 4 Jul 2024 16:02:26 +0100
Levi Yun <yeoreum.yun@arm.com> wrote:
> From: "levi.yun" <yeoreum.yun@arm.com>
>
> pid_list_fill_irq() runs via irq_work.
> When CONFIG_PREEMPT_RT is disabled, it would run in irq_context.
> so it shouldn't sleep while memory allocation.
>
> Change gfp flags from GFP_KERNEL to GFP_NOWAIT to prevent sleep in
> irq_work.
>
> This change wouldn't impact functionality in practice because the worst-size
> is 2K.
>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
and
Fixes: 8d6e90983ade ("tracing: Create a sparse bitmask for pid filtering")
Thank you,
> Signed-off-by: levi.yun <yeoreum.yun@arm.com>
> ---
> kernel/trace/pid_list.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/pid_list.c b/kernel/trace/pid_list.c
> index 95106d02b32d..85de221c0b6f 100644
> --- a/kernel/trace/pid_list.c
> +++ b/kernel/trace/pid_list.c
> @@ -354,7 +354,7 @@ static void pid_list_refill_irq(struct irq_work *iwork)
> while (upper_count-- > 0) {
> union upper_chunk *chunk;
>
> - chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
> + chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT);
> if (!chunk)
> break;
> *upper_next = chunk;
> @@ -365,7 +365,7 @@ static void pid_list_refill_irq(struct irq_work *iwork)
> while (lower_count-- > 0) {
> union lower_chunk *chunk;
>
> - chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
> + chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT);
> if (!chunk)
> break;
> *lower_next = chunk;
> --
> LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-05 14:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-04 15:02 [PATCH v2] trace/pid_list: Change gfp flags in pid_list_fill_irq() Levi Yun
2024-07-05 14:11 ` Masami Hiramatsu
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).