From patchwork Fri Oct 6 11:52:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 9989061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0CDC6029B for ; Fri, 6 Oct 2017 11:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B67AD28D61 for ; Fri, 6 Oct 2017 11:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB4BE28D99; Fri, 6 Oct 2017 11:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38BE628D61 for ; Fri, 6 Oct 2017 11:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875AbdJFLwt (ORCPT ); Fri, 6 Oct 2017 07:52:49 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:54894 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751883AbdJFLwj (ORCPT ); Fri, 6 Oct 2017 07:52:39 -0400 Received: by mail-wm0-f44.google.com with SMTP id i124so7420222wmf.3 for ; Fri, 06 Oct 2017 04:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BM0/YKH14IlSLtenqYhmFkxLkWozNREZqebNuJMvV1w=; b=KInFBccO6ea6fhgujT2ogQ8lfSmeI0J/nsrHs7GRlKId6tHHxI7UMrDaLBIeA1EBUg wTU+80LB3O0cQpgrZYicW92gYe66NE9Zh0o3fUY9MJ+/pAzPaAY1bAML894nBsQtYaYY biztwYjn6NQqFyXoLxintxPPsTwzYvVlcgb4PFM9vhlQAXeOqQD/WNmWjERlk5bcn6MM 2T8mwkO9sY9scLnIblWamjRZlss3USjewCUG/inncp7JKq3aLzs3jyNgMJWzfbfPBML5 deXq3mfG6bYiPUSkNfcnl8+/SfeqW3cUy+KwafnctSRFGWrFEoxCy1T9qv8yH3YaQMG0 rlLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BM0/YKH14IlSLtenqYhmFkxLkWozNREZqebNuJMvV1w=; b=NndLYFS9siTyjHZI70jkB+3UaItsrc3xN4VzuqYgaepb4vwpV0MlqHCJs8UGRZ42xS 1x3CuiCsKws847zvFyFMudZqvgbr2+i9qWVlwHIfqJZ0XHuomc3rt9Wba9UutV5zFuto 2VPRr6VyB1x9GekZLRAgMqD5sKFneEHaHHxMAN7FnvF5mMu3QwH69Z6+vc+93LVpzWBX t4HqKcXq6CStVS8UdQKlMZbzMpgaEMLJsOjmMXz0C1b58H3PSrZoZx9fK556FdUJYpBy SyTG+2feTpmHD4vKqtZzLzcHhmbFw63yuGUkOKXPU6sRzQbvzu/ftp/UCMUUST5ZJrPz vD3w== X-Gm-Message-State: AMCzsaU0Fuyz0+npual52Pve72zzIIJMSmy4WsEn11lfYdfToD6RglJ6 lEcqBdEjhfD8WW1IVK3QV07yGQ== X-Google-Smtp-Source: AOwi7QAQ5nAJCRsxCX7mwQNjHTdQpWC76fDCs5QeV/DaCqbvp2KCfN8u+hsYQhkyGf1ij9H3cOqKkA== X-Received: by 10.80.139.65 with SMTP id l59mr2960972edl.187.1507290758558; Fri, 06 Oct 2017 04:52:38 -0700 (PDT) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id j6sm1330240edj.58.2017.10.06.04.52.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Oct 2017 04:52:38 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 2/2] lightnvm: pblk: avoid being reported as hung on rated GC Date: Fri, 6 Oct 2017 13:52:22 +0200 Message-Id: <1507290742-8970-3-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507290742-8970-1-git-send-email-javier@cnexlabs.com> References: <1507290742-8970-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The amount of GC I/O on the write buffer is managed by the rate-limiter, which is calculated as a function of the number of available free blocks. When reaching the stable point, we risk having scheduled more I/Os for GC than are allowed on the write buffer. This would result on the GC semaphore balancing the outstanding read GC I/Os to be reported as "hung", though the behavior is normal. Solve this by allowing to schedule when we detect that the read GC path is not moving forward. Signed-off-by: Javier González --- drivers/lightnvm/pblk-gc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c index b8323e34d1bc..00d5698d64a9 100644 --- a/drivers/lightnvm/pblk-gc.c +++ b/drivers/lightnvm/pblk-gc.c @@ -218,7 +218,13 @@ static void pblk_gc_line_prepare_ws(struct work_struct *work) gc_rq_ws->line = line; gc_rq_ws->priv = gc_rq; - down(&gc->gc_sem); + /* The write GC path can be much slower than the read GC one due to + * the budget imposed by the rate-limiter. Balance in case that we get + * back pressure from the write GC path. + */ + while (down_timeout(&gc->gc_sem, msecs_to_jiffies(30000))) + io_schedule(); + kref_get(&line->ref); INIT_WORK(&gc_rq_ws->ws, pblk_gc_line_ws);