From patchwork Fri Oct 13 12:46:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004469 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 54C5960216 for ; Fri, 13 Oct 2017 12:48:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 471EB28FD4 for ; Fri, 13 Oct 2017 12:48:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C1F229057; Fri, 13 Oct 2017 12:48:27 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 CDEFF28FD4 for ; Fri, 13 Oct 2017 12:48:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932592AbdJMMsF (ORCPT ); Fri, 13 Oct 2017 08:48:05 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:49065 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932548AbdJMMsB (ORCPT ); Fri, 13 Oct 2017 08:48:01 -0400 Received: by mail-wm0-f67.google.com with SMTP id i124so21107809wmf.3 for ; Fri, 13 Oct 2017 05:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DW0vDBQmiHVLXeOxsy2yrQ8TmK0gmUxrcX7qzJie0RA=; b=pZTsYsFFY96YSKTtGQKndwm9lTgq2Tr3aj59fHnKULbJThO9LaREnOhtNsYnIkpuPR UW2Y3YL4HB4PAr115bttJFrVnpn6hpSqmA1H7Vl4Iz33SvHjh1hvAcXPCDd16Z3md0rw ApDc0GtlR4Kt8FDXTVYn/ExBOriPCHn3XvkRY= 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=DW0vDBQmiHVLXeOxsy2yrQ8TmK0gmUxrcX7qzJie0RA=; b=qLCB2QEEXXvczHt/T3ff+D3WJMYJZ54+L0146Yj9oR3uJIFS7k7zT4bWw4IH5p9xjs HJxCCJTUhH4vjaIFbBwsM5BjarEuGvgJy3kKX2IYwsnkMyxiM442T87YyS2j+GuuoDWa dxfOmrDBoXNocTlO4/e8gVDiuZQm/SXW8+uOM48212+f/qzaKqvDFKPlXJgZvbKJbzGl fqyH6302MlpAGCB+jw7KK1BMSL81KhSysP3F6DFxEiZPTv2HepFLLV37w8kwGBB99NKe J+Y5gzXIrx4mqsBJRJUp5zjS6yfi9D0202HKYb6tszECFXhI8ZmQZolpvlepj/V7ICxK vMEg== X-Gm-Message-State: AMCzsaXKUUKo1oPbTPnJnr86RrrUAKv6gaO2s9gF5SlUzTkCFpTsExo9 Rx5S4uQrs/hvqUEgQnwBZJQ2trCE X-Google-Smtp-Source: AOwi7QC9iPivKxeDcWNQ/fjzWHltYms+5yX95B4apYtek8kW+XH2+vsNcvpANUd4a28czUF3r+vzgA== X-Received: by 10.80.152.103 with SMTP id h36mr2005728edb.293.1507898880334; Fri, 13 Oct 2017 05:48:00 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:59 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 56/58] lightnvm: pblk: avoid being reported as hung on rated GC Date: Fri, 13 Oct 2017 14:46:45 +0200 Message-Id: <20171013124647.32668-57-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> 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 From: Javier González 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 Signed-off-by: Matias Bjørling --- 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 b8323e3..00d5698 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);