Skip to contentSkip to conversation

trace/pid_list: Change gfp flags in pid_list_fill_irq()

PATCH In review Levi Yun 2 participants 2 messages Jul 4, 2024 – Jul 5, 2024 Tracing

lore
Share & tools
lore

Levi Yun

author
#0 lore raw

PATCH v2 1/1 trace/pid_list: Change gfp flags in pid_list_fill_irq()

From: "levi.yun" <[email protected]>

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.

---
 kernel/trace/pid_list.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/pid_list.c +2 -2
index 95106d02b32d..85de221c0b6f 100644
@@ -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}

maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · On Thu, 4 Jul 2024 16:02:26 +0100 Levi Yun <[email protected]> wrote:

From: "levi.yun" <[email protected]>

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.

Quoted 6 lines

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.

and

Fixes 8d6e90983ade ("tracing: Create a sparse bitmask for pid filtering")

Thank you,

Quoted 31 lines
---
 kernel/trace/pid_list.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/pid_list.c +2 -3
index 95106d02b32d..85de221c0b6f 100644
@@ -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}

Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>