[RFC PATCH 4/6] common/Throttle: FIFO throttler doesn't need to signal waiters when max changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Only wait() and get() change the throttle max.
If there are no current waiters, the thread calling wait()/get()
doesn't need to signal itself.
If there are current waiters, the thread calling wait()/get() will
signal the oldest waiter in _wait() before sleeping, so the oldest
waiter always sees the new throttle limit immediately.
Signed-off-by: Jim Schutt <jaschut@xxxxxxxxxx>
---
src/common/Throttle.h | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/common/Throttle.h b/src/common/Throttle.h
index ca72060..2f74f4a 100644
--- a/src/common/Throttle.h
+++ b/src/common/Throttle.h
@@ -25,11 +25,6 @@ public:
}
private:
- void _reset_max(int64_t m) {
- if (m < max && !cond.empty())
- cond.front()->SignalOne();
- max = m;
- }
bool _should_wait(int64_t c) {
return
max &&
@@ -74,7 +69,7 @@ public:
*sleep_seq = sseq;
if (m) {
assert(m > 0);
- _reset_max(m);
+ max = m;
}
bool r = _wait(0);
wseq++;
@@ -99,7 +94,7 @@ public:
*sleep_seq = sseq;
if (m) {
assert(m > 0);
- _reset_max(m);
+ max = m;
}
_wait(c);
count += c;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[CEPH Users]
[Information on CEPH]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]