Skip to contentSkip to conversation

net: pktgen: don't abuse current->state in pktgen_thread_worker()

PATCH Applied Oleg Nesterov 3 participants 5 messages Aug 4, 2015 – Aug 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: pktgen: don't abuse current->state in pktgen_thread_worker()

Commit 1fbe4b46caca "net: pktgen: kill the Wait for kthread_stop code in pktgen_thread_worker()" removed (in particular) the final __set_current_state(TASK_RUNNING) and I didn't notice the previous set_current_state(TASK_INTERRUPTIBLE). This triggers the warning in __might_sleep() after return.

Afaics, we can simply remove both set_current_state()'s, and we could do this a long ago right after ef87979c273a2 "pktgen: better scheduler friendliness" which changed pktgen_thread_worker() to use wait_event_interruptible_timeout().

---
 net/core/pktgen.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
net/core/pktgen.c +0 -3
index 8e0181a..6717684 100644
@@ -3432,8 +3432,6 @@ static int pktgen_thread_worker(void *arg)
 
 	set_freezable();
 
-	__set_current_state(TASK_RUNNING);
-
 	while (!kthread_should_stop()) {
 		pkt_dev = next_to_run(t);
 
@@ -3478,7 +3476,6 @@ static int pktgen_thread_worker(void *arg)
 
 		try_to_freeze();
 	}
-	set_current_state(TASK_INTERRUPTIBLE);
 
 	pr_debug("%s stopping all device\n", t->tsk->comm);
 	pktgen_stop(t);
Signature · 1 line
1.5.5.1
#1 lore raw
Quoted 6 lines · Oleg Nesterov

Commit 1fbe4b46caca "net: pktgen: kill the Wait for kthread_stop code in pktgen_thread_worker()" removed (in particular) the final __set_current_state(TASK_RUNNING) and I didn't notice the previous set_current_state(TASK_INTERRUPTIBLE). This triggers the warning in __might_sleep() after return.

Quoted 7 lines

Afaics, we can simply remove both set_current_state()'s, and we could do this a long ago right after ef87979c273a2 "pktgen: better scheduler friendliness" which changed pktgen_thread_worker() to use wait_event_interruptible_timeout().

Interesting that it didn't happen in my tests yet per description it should have. Huang, did you do anything special to trigger this?

#2 lore raw
Quoted 13 lines · Marcelo Ricardo Leitner
Quoted 11 lines · Oleg Nesterov

Commit 1fbe4b46caca "net: pktgen: kill the Wait for kthread_stop code in pktgen_thread_worker()" removed (in particular) the final __set_current_state(TASK_RUNNING) and I didn't notice the previous set_current_state(TASK_INTERRUPTIBLE). This triggers the warning in __might_sleep() after return.

Afaics, we can simply remove both set_current_state()'s, and we could do this a long ago right after ef87979c273a2 "pktgen: better scheduler friendliness" which changed pktgen_thread_worker() to use wait_event_interruptible_timeout().

Quoted 5 lines
Quoted 2 lines

Interesting that it didn't happen in my tests yet per description it should have. Huang, did you do anything special to trigger this?

Do you have CONFIG_DEBUG_ATOMIC_SLEEP=y ?

Oleg.

#3 lore raw
Quoted 14 lines · Oleg Nesterov
Quoted 13 lines · Marcelo Ricardo Leitner
Quoted 11 lines · Oleg Nesterov

Commit 1fbe4b46caca "net: pktgen: kill the Wait for kthread_stop code in pktgen_thread_worker()" removed (in particular) the final __set_current_state(TASK_RUNNING) and I didn't notice the previous set_current_state(TASK_INTERRUPTIBLE). This triggers the warning in __might_sleep() after return.

Afaics, we can simply remove both set_current_state()'s, and we could do this a long ago right after ef87979c273a2 "pktgen: better scheduler friendliness" which changed pktgen_thread_worker() to use wait_event_interruptible_timeout().

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Interesting that it didn't happen in my tests yet per description it should have. Huang, did you do anything special to trigger this?

Do you have CONFIG_DEBUG_ATOMIC_SLEEP=y ?

Ahh yes, probably not. Thanks.

Marcelo

maintainer Applied
#4 lore raw
In reply to Oleg Nesterov

From: Oleg Nesterov <[email protected]>
Date: Tue, 4 Aug 2015 18:33:34 +0200

Quoted 6 lines

Commit 1fbe4b46caca "net: pktgen: kill the Wait for kthread_stop code in pktgen_thread_worker()" removed (in particular) the final __set_current_state(TASK_RUNNING) and I didn't notice the previous set_current_state(TASK_INTERRUPTIBLE). This triggers the warning in __might_sleep() after return.

Quoted 7 lines

Afaics, we can simply remove both set_current_state()'s, and we could do this a long ago right after ef87979c273a2 "pktgen: better scheduler friendliness" which changed pktgen_thread_worker() to use wait_event_interruptible_timeout().

Applied, thank you.