From patchwork Mon Apr 6 19:58:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 6165011 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 60F339F1BE for ; Mon, 6 Apr 2015 20:14:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82B1520303 for ; Mon, 6 Apr 2015 20:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92928202EC for ; Mon, 6 Apr 2015 20:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421AbbDFT7u (ORCPT ); Mon, 6 Apr 2015 15:59:50 -0400 Received: from mail-qk0-f171.google.com ([209.85.220.171]:33282 "EHLO mail-qk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752819AbbDFT7k (ORCPT ); Mon, 6 Apr 2015 15:59:40 -0400 Received: by qkx62 with SMTP id 62so31079332qkx.0; Mon, 06 Apr 2015 12:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=eZUjCGIC0NMGaZPwzrArbcgMoDGRLA3NkyicuPGgU5g=; b=P3UdVqle8etyd7ntSs3a7W2bUDKRci3P0bevbuS+KS/mfbqG68d9eG2zULOWHwQAEw NK44KqjjP8K7bZUK7LayRBm1FR8Ykc+hbjCgoNVGce9K/K3LM3FgJENUzeZvRDKL6glX gbeQF1RJM1JfSPHFjZojeEmqG13CEf3XTy497A6cjIttKVKN2wHV8D5FWh2L8LLWIo7L KoRprByI+twIjlyu7gVso1+ySEVCQAAoMGk1eQ2CWOkshSSVYZt65WCSUTJDBLVQxAp6 qm1ndRZ7Bv/y+r2Tebz8XtAFsKoszSRkwleBq5Rhl4CyczzytZGbVz7C+yUF1xtnDGrJ RKgA== X-Received: by 10.55.16.139 with SMTP id 11mr31723082qkq.79.1428350379887; Mon, 06 Apr 2015 12:59:39 -0700 (PDT) Received: from htj.duckdns.org.lan (207-38-238-8.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com. [207.38.238.8]) by mx.google.com with ESMTPSA id z67sm3914418qgz.10.2015.04.06.12.59.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 12:59:39 -0700 (PDT) From: Tejun Heo To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, jack@suse.cz, hch@infradead.org, hannes@cmpxchg.org, linux-fsdevel@vger.kernel.org, vgoyal@redhat.com, lizefan@huawei.com, cgroups@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.cz, clm@fb.com, fengguang.wu@intel.com, david@fromorbit.com, gthelen@google.com, Tejun Heo Subject: [PATCH 28/49] writeback, blkcg: propagate non-root blkcg congestion state Date: Mon, 6 Apr 2015 15:58:17 -0400 Message-Id: <1428350318-8215-29-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428350318-8215-1-git-send-email-tj@kernel.org> References: <1428350318-8215-1-git-send-email-tj@kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that bdi layer can handle per-blkcg bdi_writeback_congested state, blk_{set|clear}_congested() can propagate non-root blkcg congestion state to them. This can be easily achieved by disabling the root_rl tests in blk_{set|clear}_congested(). Note that we still need those tests when !CONFIG_CGROUP_WRITEBACK as otherwise we'll end up flipping root blkcg wb's congestion state for events happening on other blkcgs. v2: Updated for bdi_writeback_congested. Signed-off-by: Tejun Heo Cc: Jens Axboe Cc: Jan Kara Cc: Vivek Goyal --- block/blk-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index cad26e3..95488fb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -65,23 +65,26 @@ static struct workqueue_struct *kblockd_workqueue; static void blk_clear_congested(struct request_list *rl, int sync) { - if (rl != &rl->q->root_rl) - return; #ifdef CONFIG_CGROUP_WRITEBACK clear_wb_congested(rl->blkg->wb_congested, sync); #else - clear_wb_congested(rl->q->backing_dev_info.wb.congested, sync); + /* + * If !CGROUP_WRITEBACK, all blkg's map to bdi->wb and we shouldn't + * flip its congestion state for events on other blkcgs. + */ + if (rl == &rl->q->root_rl) + clear_wb_congested(rl->q->backing_dev_info.wb.congested, sync); #endif } static void blk_set_congested(struct request_list *rl, int sync) { - if (rl != &rl->q->root_rl) - return; #ifdef CONFIG_CGROUP_WRITEBACK set_wb_congested(rl->blkg->wb_congested, sync); #else - set_wb_congested(rl->q->backing_dev_info.wb.congested, sync); + /* see blk_clear_congested() */ + if (rl == &rl->q->root_rl) + set_wb_congested(rl->q->backing_dev_info.wb.congested, sync); #endif }