Thread (3 messages) flat view 3 messages, 2 authors, 2021-09-24

Re: [PATCH net-next] net: make napi_disable() symmetric with enable

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-09-24 20:21:39

On Fri, 24 Sep 2021 07:30:30 -0700 Eric Dumazet wrote:
quoted
 void napi_disable(struct napi_struct *n)
 {
+	unsigned long val, new;
+
 	might_sleep();
 	set_bit(NAPI_STATE_DISABLE, &n->state);
 
-	while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
-		msleep(1);
-	while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
-		msleep(1);
+	do {
+		val = READ_ONCE(n->state);
+		if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
+			msleep(1);  
Patch seems good to me.

We also could replace this pessimistic msleep(1) with more opportunistic usleep_range(20, 200)
Will do, thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help