Skip to contentSkip to conversation

Revert "printk: wake up all waiters"

PATCH In review John Ogness 3 participants 3 messages May 26, 2022 – May 27, 2022 Printk

lore
Share & tools
lore

John Ogness

author maintainer
#0 lore raw

PATCH 1/1 Revert "printk: wake up all waiters"

This reverts commit 938ba4084abcf6fdd21d9078513c52f8fb9b00d0.

The wait queue @log_wait never has exclusive waiters, so there is no need to use wake_up_interruptible_all(). Using wake_up_interruptible() was the correct function to wake all waiters.

Since there are no exclusive waiters, erroneously changing wake_up_interruptible() to wake_up_interruptible_all() did not result in any behavior change. However, using wake_up_interruptible_all() on a wait queue without exclusive waiters is fundamentally wrong.

Go back to using wake_up_interruptible() to wake all waiters.

---
 kernel/printk/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
index a3e1035929b0..ea3dd55709e7 100644
@@ -3904,7 +3904,7 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work)
 	}
 
 	if (pending & PRINTK_PENDING_WAKEUP)
-		wake_up_interruptible_all(&log_wait);
+		wake_up_interruptible(&log_wait);
 }
 
 static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) =
Signature · 1 line
2.30.2
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Thu, 26 May 2022 22:36:56 +0206 John Ogness <[email protected]>…

This reverts commit 938ba4084abcf6fdd21d9078513c52f8fb9b00d0.

The wait queue @log_wait never has exclusive waiters, so there is no need to use wake_up_interruptible_all(). Using wake_up_interruptible() was the correct function to wake all waiters.

Quoted 7 lines

Since there are no exclusive waiters, erroneously changing wake_up_interruptible() to wake_up_interruptible_all() did not result in any behavior change. However, using wake_up_interruptible_all() on a wait queue without exclusive waiters is fundamentally wrong.

Go back to using wake_up_interruptible() to wake all waiters.

(Just to show that I have been paying attention ;-)

-- Steve

Quoted 19 lines
---
 kernel/printk/printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
index a3e1035929b0..ea3dd55709e7 100644
@@ -3904,7 +3904,7 @@ static void wake_up_klogd_work_func(struct irq_work *irq_work)
 	}
 
 	if (pending & PRINTK_PENDING_WAKEUP)
-		wake_up_interruptible_all(&log_wait);
+		wake_up_interruptible(&log_wait);
 }
 
 static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) =
maintainer
#2 lore raw
In reply to John Ogness
Quoted 13 lines · John Ogness

This reverts commit 938ba4084abcf6fdd21d9078513c52f8fb9b00d0.

The wait queue @log_wait never has exclusive waiters, so there is no need to use wake_up_interruptible_all(). Using wake_up_interruptible() was the correct function to wake all waiters.

Since there are no exclusive waiters, erroneously changing wake_up_interruptible() to wake_up_interruptible_all() did not result in any behavior change. However, using wake_up_interruptible_all() on a wait queue without exclusive waiters is fundamentally wrong.

Quoted 3 lines

Go back to using wake_up_interruptible() to wake all waiters.

The patch has been committed into printk/linux.git, branch rework/printk.

I am going to create the pull request the following week after it gets at least one spin in linux-next.

It is trivial patch so that it might be sent directly. But it does not affect the functionality and is is not urgent either.

Best Regards,
Petr