From patchwork Fri Jun 29 19:25:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10497369 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 4A15B60325 for ; Fri, 29 Jun 2018 19:27:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B19D29754 for ; Fri, 29 Jun 2018 19:27:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E1492984F; Fri, 29 Jun 2018 19:27:19 +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=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 D85D329754 for ; Fri, 29 Jun 2018 19:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932377AbeF2T03 (ORCPT ); Fri, 29 Jun 2018 15:26:29 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:43583 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936275AbeF2T0F (ORCPT ); Fri, 29 Jun 2018 15:26:05 -0400 Received: by mail-qt0-f195.google.com with SMTP id c8-v6so8820241qtp.10 for ; Fri, 29 Jun 2018 12:26:05 -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=I1KqJ09/Y9VO/VmHIddPxhlI+JNBCrcVYnWeMoZOd/c=; b=Ov8xea/y8QEs2VzZ3lU1vnXx1Ntzy8yO/UstJ/rEdlIP1+ZCOgbdIta8PBIamYqLL7 Ocb0WNJofDZGBkz45mFNxZmiosHU/LZf2To0WV1bOw5UMGBzw/Rv+MEM6sHSWiTNcXYM spVOboERE1RTPy5DIVaZXOwK1H+OiUGpQY6KeSMpNwAtpyAJEvaoLMVLD3Ug4ou0WJJ2 x8tPOCJkd7Wi5YTrpFqLO2mZB6M1LhxzKbIUqGGrxNJqe6Lx5iGUeOn5BKg8fRN290Ep pcmmdlFUQRxxJGBqYMdAaV8trxIaSHfmrqqYgxwu38pFISpZ7lmVDAozu5NAva5z1thK 8V0A== 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=I1KqJ09/Y9VO/VmHIddPxhlI+JNBCrcVYnWeMoZOd/c=; b=ppVw7V8N6H4/VzR3YV9zZL/wYH6kwX3B0zB4G+72Kt7fxZNstrEX9PQIvFx3G9++rb 8ZIENB570PvHTAEbdPCDoMLeqTq5Y2l0FpOq6MimuYlQgQ+lRwiBS4itG4Lw98WzHomv v+wtmgAzNzoSQY/XE0OO9zyNj4Pd7Dts/7hskdqwXntSrjQZWkxfCeDL65WPy3pHD8Oo FB5+h2XVVPj2UEvucbzDpbrNZrI8KTweHcFkxeH9Ee/IsuDjfa0ctC8KIB7F/StLNqNx OOYVCJV5j4ZolahlBKsKPu3JzYTOROxSt5P5AjfpH4OJlI9BcjEKuX1dzcDwuPYzHcSr ulFQ== X-Gm-Message-State: APt69E2cfZJM18vLmP8QU6AieI/Dc1tDvl7EOgOps4JkwKVH8fXiYm4B gL0ys1M1sXftkJ2smImu8Ss4IQ== X-Google-Smtp-Source: AAOMgpcIO+zbPtxloUkt2CN4dRaq8BZAKF27OQQiLwiUtRZwA0U/S+bODwKm19+wCml0sPvXillhzg== X-Received: by 2002:ac8:40ca:: with SMTP id f10-v6mr14375253qtm.387.1530300364762; Fri, 29 Jun 2018 12:26:04 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id a127-v6sm5798121qkd.9.2018.06.29.12.26.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 12:26:04 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 14/14] skip readahead if the cgroup is congested Date: Fri, 29 Jun 2018 15:25:42 -0400 Message-Id: <20180629192542.26649-15-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180629192542.26649-1-josef@toxicpanda.com> References: <20180629192542.26649-1-josef@toxicpanda.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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 --- mm/readahead.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index 539bbb6c1fad..cda6b09e0a59 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "internal.h" @@ -500,6 +501,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); @@ -550,6 +554,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); }