From patchwork Mon Jan 21 13:30:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Dachary X-Patchwork-Id: 2012321 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id BE2CB3FDD2 for ; Mon, 21 Jan 2013 13:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993Ab3AUNaN (ORCPT ); Mon, 21 Jan 2013 08:30:13 -0500 Received: from smtp.dmail.dachary.org ([86.65.39.20]:35246 "EHLO smtp.dmail.dachary.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751661Ab3AUNaN (ORCPT ); Mon, 21 Jan 2013 08:30:13 -0500 Received: by smtp.dmail.dachary.org (Postfix, from userid 65534) id E41AC26397; Mon, 21 Jan 2013 14:30:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on dmail.dachary.vm.gnt X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.5 Received: from [10.8.2.6] (unknown [10.8.0.22]) by smtp.dmail.dachary.org (Postfix) with ESMTPS id E7A1226394 for ; Mon, 21 Jan 2013 14:30:08 +0100 (CET) Message-ID: <50FD42E0.3040101@dachary.org> Date: Mon, 21 Jan 2013 14:30:08 +0100 From: Loic Dachary Organization: Artisan Logiciel Libre User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.9) Gecko/20121014 Icedove/10.0.9 MIME-Version: 1.0 To: Ceph Development Subject: [PATCH] Always Signal() the first Cond when changing the maximum X-Enigmail-Version: 1.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Removes a test by which the waiting queue is only Signal()ed if the new maximum is lower than the current maximum. There is no evidence of a use case where such a restriction would be useful. In addition waking up a thread when the maximum increases gives it a chance to immediately continue the suspended process instead of waiting for the next put(). For additional context see the discussion at http://marc.info/?t=135868938300001&r=1&w=4 Signed-off-by: Loic Dachary --- src/common/Throttle.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 844263a..82ffe7a 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -65,7 +65,7 @@ Throttle::~Throttle() void Throttle::_reset_max(int64_t m) { assert(lock.is_locked()); - if (m < ((int64_t)max.read()) && !cond.empty()) + if (!cond.empty()) cond.front()->SignalOne(); logger->set(l_throttle_max, m); max.set((size_t)m);