Skip to contentSkip to conversation

rtsx_usb_ms: Use msleep_interruptible() in polling loop

PATCH RESEND In review Ben Hutchings 3 participants 8 messages Sep 28, 2015 – Oct 9, 2015 Sony memorystick

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 rtsx_usb_ms: Use msleep_interruptible() in polling loop

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 2 lines
Ben Hutchings
All extremists should be taken out and shot.
#1 lore raw

The subsystem is missing from the subject line.

Quoted 11 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

How was this patch made? Where's the diff etc?

Why was this patch sent to me?

Quoted 13 lines

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 11 lines · Lee Jones

The subsystem is missing from the subject line.

Quoted 8 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that
should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

Quoted 7 lines
Quoted 5 lines

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

How was this patch made? Where's the diff etc?

With quilt.

Quoted 1 line

Why was this patch sent to me?

I think I must have added you previously as MFD maintainer, but as this doesn't touch rtsx_pcr or rtsx_usb it's not really in your area. Sorry to bother you.

Ben.

Quoted 14 lines
Quoted 13 lines

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 2 lines
Ben Hutchings
All extremists should be taken out and shot.
#3 lore raw
Quoted 15 lines · Ben Hutchings
Quoted 14 lines · Lee Jones

The subsystem is missing from the subject line.

Quoted 11 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that
should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

References: https://bugs.debian.org/765717

How was this patch made? Where's the diff etc?

With quilt.

Old Skool! ;)

Quoted 5 lines
Quoted 1 line

Why was this patch sent to me?

I think I must have added you previously as MFD maintainer, but as this doesn't touch rtsx_pcr or rtsx_usb it's not really in your area. Sorry to bother you.

No worries.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
In reply to Ben Hutchings
Quoted 8 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

The change should be OK providing it does the same delay. You can add my ack.

Quoted 15 lines

References: https://bugs.debian.org/765717

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 3 lines
Best regards,
Roger Tseng
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
#5 lore raw
In reply to Ben Hutchings
Quoted 11 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

Any chance you can use Git instead of Quilt? Failing that, is there a way to tell Quilt to supply a diffstat in the patch?

Quoted 13 lines

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#6 lore raw
Quoted 9 lines · Lee Jones
Quoted 7 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

Quoted 7 lines
Quoted 4 lines

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

Any chance you can use Git instead of Quilt? Failing that, is there a way to tell Quilt to supply a diffstat in the patch?

Why does it matter? 'git am' is happy to apply it. But in case it really does make a difference, I've attached the git-format-patch version.

Ben.

Quoted 16 lines
Quoted 13 lines

---

drivers/memstick/host/rtsx_usb_ms.c +2 -1
@@ -706,7 +706,8 @@ poll_again:
 > > 	> > 	> > if (host->eject)
 > > 	> > 	> > 	> > break;
 
-> > 	> > 	> > msleep(1000);
+> > 	> > 	> > if (msleep_interruptible(1000))
+> > 	> > 	> > 	> > flush_signals(current);
 > > 	> > }
 
 > > 	> > complete(&host->detect_ms_exit);
Signature · 2 lines
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.

From 34dca6b208a1108a9499412f584468b31ee025e0 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <[email protected]>
Date: Sun, 26 Oct 2014 03:39:42 +0000
Subject: [PATCH] rtsx_usb_ms: Use msleep_interruptible() in polling loop

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

---
 drivers/memstick/host/rtsx_usb_ms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/memstick/host/rtsx_usb_ms.c +2 -1
index 1105db2..645dede 100644
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
#7 lore raw
Quoted 12 lines · Ben Hutchings
Quoted 11 lines · Lee Jones
Quoted 9 lines · Ben Hutchings

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

References: https://bugs.debian.org/765717

Any chance you can use Git instead of Quilt? Failing that, is there a way to tell Quilt to supply a diffstat in the patch?

Why does it matter?

To this patch? It probably doesn't.

In general? It absolutely helps with patch review -- it's the second thing I look at. Diffstats are especially helpful if/when patches cross subsystem boundaries or when multiple files a touched. Until I scroll down I have no idea if this is just a memstick patch (which I can see at the bottom of my screen) or in fact amends 5 subsystems and requires special handling.

Quoted 3 lines

'git am' is happy to apply it. But in case it
really does make a difference, I've attached the git-format-patch version.

I meant more 'from now on', rather than that patch being a special case. Ultimately it's your decision. I just think it makes things that little bit easier for the reviewer, as I'm sure you can appreciate.

Quoted 51 lines
Quoted 7 lines
Quoted 7 lines

---

drivers/memstick/host/rtsx_usb_ms.c +0 -0
@@ -706,7 +706,8 @@ poll_again:
 > > 	> > 	> > if (host->eject)
 > > 	> > 	> > 	> > break;
 
Quoted 9 lines

drivers/memstick/host/rtsx_usb_ms.c poll_again: · line 713

Quoted 6 lines
drivers/memstick/host/rtsx_usb_ms.c +2 -1
-> > 	> > 	> > msleep(1000);
+> > 	> > 	> > if (msleep_interruptible(1000))
+> > 	> > 	> > 	> > flush_signals(current);
 > > 	> > }
 
 > > 	> > complete(&host->detect_ms_exit);

From 34dca6b208a1108a9499412f584468b31ee025e0 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <[email protected]>
Date: Sun, 26 Oct 2014 03:39:42 +0000
Subject: [PATCH] rtsx_usb_ms: Use msleep_interruptible() in polling loop

rtsx_usb_ms creates a task that mostly sleeps, but tasks in uninterruptible sleep still contribute to the load average (for bug-compatibility with Unix). A load average of ~1 on a system that should be idle is somewhat alarming.

Change the sleep to be interruptible, but still ignore signals.

A better fix might be to replace this loop with a delayed work item.

References: https://bugs.debian.org/765717

---
 drivers/memstick/host/rtsx_usb_ms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/memstick/host/rtsx_usb_ms.c +2 -1
index 1105db2..645dede 100644
@@ -706,7 +706,8 @@ poll_again:
 		if (host->eject)
 			break;
 
-		msleep(1000);
+		if (msleep_interruptible(1000))
+			flush_signals(current);
 	}
 
 	complete(&host->detect_ms_exit);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog