Skip to content

Commit 3fb65f6

Browse files
haokexindavem330
authored andcommitted
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: Kevin Hao <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2f7ccf1 commit 3fb65f6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/core/pktgen.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3669,10 +3669,8 @@ static int pktgen_thread_worker(void *arg)
36693669
if (unlikely(!pkt_dev && t->control == 0)) {
36703670
if (t->net->pktgen_exiting)
36713671
break;
3672-
wait_event_interruptible_timeout(t->queue,
3673-
t->control != 0,
3674-
HZ/10);
3675-
try_to_freeze();
3672+
wait_event_freezable_timeout(t->queue,
3673+
t->control != 0, HZ / 10);
36763674
continue;
36773675
}
36783676

0 commit comments

Comments
 (0)