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: 10497351 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 6F90860230 for ; Fri, 29 Jun 2018 19:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C20D29198 for ; Fri, 29 Jun 2018 19:26:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C2C129124; Fri, 29 Jun 2018 19:26:33 +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 D39C8294D1 for ; Fri, 29 Jun 2018 19:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934499AbeF2T03 (ORCPT ); Fri, 29 Jun 2018 15:26:29 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:46088 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936252AbeF2T0F (ORCPT ); Fri, 29 Jun 2018 15:26:05 -0400 Received: by mail-qt0-f195.google.com with SMTP id h5-v6so8813539qtm.13 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=Dzv9ljPtwvKA0soPh1qW4NQjcKVkoVC8GIYubFEL0WnPImI3ErABLQ5ephUjivXuI/ sM4vO2PyGq+FnsF31hxQ8CD6/NTOJ20ui0hCCzyyL5mnOVJLfan8kx6gYW7CGdHTkAyy Ll8pekESeRznmgtDN+D0lpArNakAKq/NbXVGtvRPpUJ7pyhqfair2eHmBgwMFOvOFu/n dPtYApoiBfP586JoZT2uq1mzRiTsF2DY6/90aKhC/KSIPdntEly5b1vMM4oR8MiL/9xH I74YbMx6a0UCO5+VGNTH6rtakF8ylYoNi4xIoaxRp9ncapyp2ZSTUSwaFMUWTK1qSblq hPlQ== X-Gm-Message-State: APt69E33Nq8eS3kSDtc1BB006lHqI7lUIdqfIJU9FwM4IKOncsyS2rM/ vmWGyf6WKHM+cRDi5vGoF8Bidg== 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-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 --- 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); }