From patchwork Wed Jun 27 19:09:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10492435 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 CC01460325 for ; Wed, 27 Jun 2018 19:10:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDA7829DAE for ; Wed, 27 Jun 2018 19:10:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB89729E61; Wed, 27 Jun 2018 19:10:40 +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 865F229E71 for ; Wed, 27 Jun 2018 19:10:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965431AbeF0TKY (ORCPT ); Wed, 27 Jun 2018 15:10:24 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:40972 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966256AbeF0TKF (ORCPT ); Wed, 27 Jun 2018 15:10:05 -0400 Received: by mail-qt0-f194.google.com with SMTP id y20-v6so2619994qto.8 for ; Wed, 27 Jun 2018 12:10: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=TlzslJfipvVt0wAvZxZiB+DjhfXTTsEWYQwxVlf2uoX57XdIjRya3H9qQ6qTeqLaQs WeevMY90SGKKpbyRtudPgRzLd56cOYyEtKxQFqir4+wTZENZqwCrJJX1bsTBnRtrtwlH ZMb59Ji/09SrXKxkQ9D3WZDsv9Z39NfA662B9KWn8MEdSEVJzQQBT3GM2NWPVmwEObDz yt/Bln2uV4e2F1m902f2b/+CbWZyhi3UeoDEC8TZLWa7yjizxeEGcKEDOM0bz7kVhUcu H4TcygzOtegpksXJpOEYg4VYj6cTBhDqdbH3q96yjfDUQBqSxNbQ2wJUO4A6wKd8lyH8 VFiQ== 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=lsVxzVbLAM7Wcu990e7Pkb/ecHYII/iWr0x8yi72bKE76nKaIkFKWHNcJyw7qdSoId 37qbtUlyVtsOODRjINfxDhyvgzcIVyVvn+wz4dowrtJPNLbi4vKJDzXbiXGmfAXNwsg8 06qmQOkjO+ierR8+dGldzPPQMB//Y5jq+HL3capyBw+sn2O7WqqGfXPavfJn8H209JTa SgWirgacNKDlLhTzo7e1ucp1FZqCnfsIs9V3MDusv82PLeeN9E5I5JYgn6DrNlB2wudv 3A4c2glmqpVK/EqNPtQlDxZvKycTaLsUqEv8DWfm6xanmaBn3b2aoNgNSqQiJAp3ddOx NqVA== X-Gm-Message-State: APt69E0MLHHrVqc+gdTPSmvmgIzwSuRBSjEBjVwM/NillUs22UPrw8Hk UTRcLYxJFAGciXIEi2wN8J6p/g== X-Google-Smtp-Source: AAOMgpd1UUVAN3lYkmYZtTvoeRlpDq/URSgW84EBrHpjPLyZ8z4c5tIaItB8J5Mt/9aTxh8z1rlYQA== X-Received: by 2002:aed:36e7:: with SMTP id f94-v6mr6716094qtb.276.1530126604636; Wed, 27 Jun 2018 12:10:04 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id y128-v6sm3448733qkc.1.2018.06.27.12.10.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 12:10:03 -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, 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: Wed, 27 Jun 2018 15:09:40 -0400 Message-Id: <20180627190940.4696-15-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180627190940.4696-1-josef@toxicpanda.com> References: <20180627190940.4696-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); }