From patchwork Mon Jun 25 15:12: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: 10486587 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 A4B7A6023A for ; Mon, 25 Jun 2018 15:15:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3365284FF for ; Mon, 25 Jun 2018 15:15:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 984042850D; Mon, 25 Jun 2018 15:15:28 +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 556AF284FF for ; Mon, 25 Jun 2018 15:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934960AbeFYPOP (ORCPT ); Mon, 25 Jun 2018 11:14:15 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:35104 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934871AbeFYPNH (ORCPT ); Mon, 25 Jun 2018 11:13:07 -0400 Received: by mail-qt0-f196.google.com with SMTP id z6-v6so12246969qti.2 for ; Mon, 25 Jun 2018 08:13:07 -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=MVm3juD2xKZX3dYF8WMBWCsBcGVI/sbBPW4FyC29SqDhEKBn7h5h6I8s1m7alhQNRG 80bAiZKJgsjz9Eju7BtwX9nR/vSSTxowg3sjqw+Ac5SKykni00uootHS4Lm22svLZWgr FQjImYVI9MxOZ8sGswWRBufoR/9/GwP/ppY5Wq+DYcbHGUrpRH+3Crq/FNl8fajydvS9 NF4ynaZvv97WmmXoh/3NUyJE5/C3eU+gkO8r87IVKs3Ab6oQLY6bpCDWqrEx8sRJf6RO XnNuGnzycw46NyouCuwv/jTxlzuos0bojiwPz/yzzXMozNXuMsEwnXdkDdGNNDl3xIUC qDDA== 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=mCB7ZrEqUJTV8t6be2dA/4p1P1258anUat1TpAV4Bg+Xq0sFVdOlkOJobFmSJq/6xT ISbtizhjkeFRQmamIhu5cCs0jgUNd39BmXWjJldclmpU3thsrOJBvhwmuzvrG36eDGRN 5Kd1gRrtCwsUlarfixHf/euEfTDALs9JAwg8RB2ielq5KRqApv/zaTDekLVUs8crCdUU sOYgueR6oUizVe38hdggetQCF/zq2zTGkherwloKbGMdn0wwnpfr1r3g6Dg0EaDd7IgN 0txCPp5mX717Qfb85QVsWJfcnMA56ANYXnfOyUozBzh3AYLCB3TtkHX6M7HKVGN2Fsnp qQDA== X-Gm-Message-State: APt69E13gCsuX4gtt6/lpvlyeevw0B9DgBWzwUEKNh/UFJ4ja38TVC5+ DJZ8Wsoo6eb6ZnYIijl73smuUg== X-Google-Smtp-Source: AAOMgpff8jfbASvhyUat7T5UuovtznVzWzuX2wecRGcxoDF3+PIR2Lt+m5SxfF2J06XsyN5YXgVedw== X-Received: by 2002:a0c:b41e:: with SMTP id u30-v6mr8718091qve.102.1529939586708; Mon, 25 Jun 2018 08:13:06 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id m63-v6sm10699398qke.9.2018.06.25.08.13.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Jun 2018 08:13:06 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 14/15] skip readahead if the cgroup is congested Date: Mon, 25 Jun 2018 11:12:42 -0400 Message-Id: <20180625151243.2132-15-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180625151243.2132-1-josef@toxicpanda.com> References: <20180625151243.2132-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 --- 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); }