From patchwork Tue Jul 3 15:15:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10504383 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 9B80060325 for ; Tue, 3 Jul 2018 15:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F3B285FE for ; Tue, 3 Jul 2018 15:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DCE128B22; Tue, 3 Jul 2018 15:15:59 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 2A7BF285FE for ; Tue, 3 Jul 2018 15:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932367AbeGCPP5 (ORCPT ); Tue, 3 Jul 2018 11:15:57 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:35615 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934122AbeGCPPa (ORCPT ); Tue, 3 Jul 2018 11:15:30 -0400 Received: by mail-qt0-f196.google.com with SMTP id z6-v6so1875932qti.2 for ; Tue, 03 Jul 2018 08:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yAOvev/teZ5lXIBJGd21BS6gvQRoa6lUzarUFbC3suM=; b=dk5TjK/OCGk+DthILXggq/KPLMq8M8T/9LBB/hysxl6G3j6OKpcECLEVlLxR3U2Kat ZU1qCtwmTt6YhI7AyaFWVNCHRN1bw5OOIIsbp/ZjnE6uKoqx5KcDkwPrZ+cwb2dri/AD V6/TC32apQf4kM5kYIN0UkZN587YyDI8ocMnfo8qATyXRuQenYaDOO+9r7dGsNVce5xA L4gNvxrQDD0VkZ4YY/DZ4fROV2UAyhyUUMZYebtVCiGUr9dC54unfAtCLIfrDJQxNwtQ bImG2d5cBqqYMtLWc83oCnlbvxR8oJBIPY1Np6MZf5IXCg8sl/Ympq4JOprN7qTUvHRs vcKw== 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; bh=yAOvev/teZ5lXIBJGd21BS6gvQRoa6lUzarUFbC3suM=; b=T1XaLyG5xm63pk4e/a/wEzU0rn8v7VAPMTxTZXpUa84LubhEVMzEX8uTILWnP+3+HB zeBsl8csi8bNkTQWSTM/TKuLif0Vk3pqD7u0JYjteRfrLgp4Xw4yijvYOQImPsjzztaY Rb9F2RgAwpQQaAq1wYt69TwRPiSgViL6Mh4hqddsIWjjloEuvfxx0rlSxTdeGwdu5zF0 iDS2uZ1S3dy+WtECD6C24BrsKciO0kKn6xvPLPU6SYDsOWo+sO7IM0ULvRatbLcYhVh+ wXG7YLkrUF4X58sKo9HOXypxpWBO3DW2xm1vJD/+MkoXkHF6QZ/TdndSCTnMR9tcx2bi 6RaA== X-Gm-Message-State: APt69E0voucQJuyUEvHQG1mGPhpB6iaDH3MyLM5P0BxUkZM/zToPy9l7 EvBpvUI23X9mWBu6r+d0hdHtkQ== X-Google-Smtp-Source: AAOMgpfRAqcA96t4xBBsi1UaguX8n5rDrgmOAc5tvyzSiEUk6doHf/hJo0Zo25nEoRgJNxJwlzc2bg== X-Received: by 2002:a0c:b39b:: with SMTP id t27-v6mr27046561qve.144.1530630929494; Tue, 03 Jul 2018 08:15:29 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id u27-v6sm916782qkl.66.2018.07.03.08.15.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jul 2018 08:15:28 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, tj@kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, kernel-team@fb.com Cc: Josef Bacik Subject: [PATCH 14/14] skip readahead if the cgroup is congested Date: Tue, 3 Jul 2018 11:15:03 -0400 Message-Id: <20180703151503.2549-15-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180703151503.2549-1-josef@toxicpanda.com> References: <20180703151503.2549-1-josef@toxicpanda.com> 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: Josef Bacik We noticed in testing we'd get pretty bad latency stalls under heavy pressure because read ahead would try to do its thing while the cgroup was under severe pressure. If we're under this much pressure we want to do as little IO as possible so we can still make progress on real work if we're a throttled cgroup, so just skip readahead if our group is under pressure. Signed-off-by: Josef Bacik Acked-by: Tejun Heo Acked-by: Andrew Morton --- mm/readahead.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index e273f0de3376..9f62b7151100 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "internal.h" @@ -505,6 +506,9 @@ void page_cache_sync_readahead(struct address_space *mapping, if (!ra->ra_pages) return; + if (blk_cgroup_congested()) + return; + /* be dumb */ if (filp && (filp->f_mode & FMODE_RANDOM)) { force_page_cache_readahead(mapping, filp, offset, req_size); @@ -555,6 +559,9 @@ page_cache_async_readahead(struct address_space *mapping, if (inode_read_congested(mapping->host)) return; + if (blk_cgroup_congested()) + return; + /* do read-ahead */ ondemand_readahead(mapping, ra, filp, true, offset, req_size); }