Commit 3fb65f6b authored by Kevin Hao's avatar Kevin Hao Committed by David S. Miller

net: pktgen: Use wait_event_freezable_timeout() for freezable kthread

A freezable kernel thread can enter frozen state during freezing by
either calling try_to_freeze() or using wait_event_freezable() and its
variants. So for the following snippet of code in a kernel thread loop:
  wait_event_interruptible_timeout();
  try_to_freeze();

We can change it to a simple wait_event_freezable_timeout() and then
eliminate a function call.
Signed-off-by: default avatarKevin Hao <haokexin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2f7ccf1d
...@@ -3669,10 +3669,8 @@ static int pktgen_thread_worker(void *arg) ...@@ -3669,10 +3669,8 @@ static int pktgen_thread_worker(void *arg)
if (unlikely(!pkt_dev && t->control == 0)) { if (unlikely(!pkt_dev && t->control == 0)) {
if (t->net->pktgen_exiting) if (t->net->pktgen_exiting)
break; break;
wait_event_interruptible_timeout(t->queue, wait_event_freezable_timeout(t->queue,
t->control != 0, t->control != 0, HZ / 10);
HZ/10);
try_to_freeze();
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment