All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker()
@ 2015-08-04 16:33 Oleg Nesterov
  2015-08-04 16:40 ` Marcelo Ricardo Leitner
  2015-08-07  6:52 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Oleg Nesterov @ 2015-08-04 16:33 UTC (permalink / raw)
  To: David S. Miller, Huang Ying
  Cc: Alexei Starovoitov, Jan Stancek, Jesper Brouer, Marcelo Leitner,
	netdev, linux-kernel

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().

Reported-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 net/core/pktgen.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8e0181a..6717684 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -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);
-- 
1.5.5.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker()
  2015-08-04 16:33 [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker() Oleg Nesterov
@ 2015-08-04 16:40 ` Marcelo Ricardo Leitner
  2015-08-04 17:08   ` Oleg Nesterov
  2015-08-07  6:52 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-08-04 16:40 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: David S. Miller, Huang Ying, Alexei Starovoitov, Jan Stancek,
	Jesper Brouer, netdev, linux-kernel

On Tue, Aug 04, 2015 at 06:33:34PM +0200, Oleg Nesterov wrote:
> 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().
> 
> Reported-by: Huang Ying <ying.huang@intel.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker()
  2015-08-04 16:40 ` Marcelo Ricardo Leitner
@ 2015-08-04 17:08   ` Oleg Nesterov
  2015-08-04 17:30     ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Nesterov @ 2015-08-04 17:08 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: David S. Miller, Huang Ying, Alexei Starovoitov, Jan Stancek,
	Jesper Brouer, netdev, linux-kernel

On 08/04, Marcelo Ricardo Leitner wrote:
>
> On Tue, Aug 04, 2015 at 06:33:34PM +0200, Oleg Nesterov wrote:
> > 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().
> >
> > Reported-by: Huang Ying <ying.huang@intel.com>
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
>
> 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker()
  2015-08-04 17:08   ` Oleg Nesterov
@ 2015-08-04 17:30     ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 5+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-08-04 17:30 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: David S. Miller, Huang Ying, Alexei Starovoitov, Jan Stancek,
	Jesper Brouer, netdev, linux-kernel

On Tue, Aug 04, 2015 at 07:08:27PM +0200, Oleg Nesterov wrote:
> On 08/04, Marcelo Ricardo Leitner wrote:
> >
> > On Tue, Aug 04, 2015 at 06:33:34PM +0200, Oleg Nesterov wrote:
> > > 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().
> > >
> > > Reported-by: Huang Ying <ying.huang@intel.com>
> > > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> >
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker()
  2015-08-04 16:33 [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker() Oleg Nesterov
  2015-08-04 16:40 ` Marcelo Ricardo Leitner
@ 2015-08-07  6:52 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-08-07  6:52 UTC (permalink / raw)
  To: oleg; +Cc: ying.huang, ast, jstancek, brouer, mleitner, netdev, linux-kernel

From: Oleg Nesterov <oleg@redhat.com>
Date: Tue, 4 Aug 2015 18:33:34 +0200

> 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().
> 
> Reported-by: Huang Ying <ying.huang@intel.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-07  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-04 16:33 [PATCH] net: pktgen: don't abuse current->state in pktgen_thread_worker() Oleg Nesterov
2015-08-04 16:40 ` Marcelo Ricardo Leitner
2015-08-04 17:08   ` Oleg Nesterov
2015-08-04 17:30     ` Marcelo Ricardo Leitner
2015-08-07  6:52 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.