linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
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 <jbacik@fb.com>
Subject: [PATCH 14/14] skip readahead if the cgroup is congested
Date: Fri, 29 Jun 2018 15:25:42 -0400	[thread overview]
Message-ID: <20180629192542.26649-15-josef@toxicpanda.com> (raw)
In-Reply-To: <20180629192542.26649-1-josef@toxicpanda.com>

From: Josef Bacik <jbacik@fb.com>

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 <jbacik@fb.com>
---
 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 <linux/syscalls.h>
 #include <linux/file.h>
 #include <linux/mm_inline.h>
+#include <linux/blk-cgroup.h>
 
 #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);
 }
-- 
2.14.3

  parent reply	other threads:[~2018-06-29 19:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 19:25 [PATCH 00/14][V5] Introduce io.latency io controller for cgroups Josef Bacik
2018-06-29 19:25 ` [PATCH 01/14] block: add bi_blkg to the bio " Josef Bacik
2018-06-29 19:25 ` [PATCH 02/14] block: introduce bio_issue_as_root_blkg Josef Bacik
2018-06-29 19:25 ` [PATCH 03/14] blk-cgroup: allow controllers to output their own stats Josef Bacik
2018-07-02 21:06   ` Tejun Heo
2018-06-29 19:25 ` [PATCH 04/14] blk: introduce REQ_SWAP Josef Bacik
2018-07-02 21:47   ` Jens Axboe
2018-06-29 19:25 ` [PATCH 05/14] swap,blkcg: issue swap io with the appropriate context Josef Bacik
2018-06-29 19:25 ` [PATCH 06/14] blkcg: add generic throttling mechanism Josef Bacik
2018-06-29 19:25 ` [PATCH 07/14] memcontrol: schedule throttling if we are congested Josef Bacik
2018-06-29 19:25 ` [PATCH 08/14] blk-stat: export helpers for modifying blk_rq_stat Josef Bacik
2018-06-29 19:25 ` [PATCH 09/14] blk-rq-qos: refactor out common elements of blk-wbt Josef Bacik
2018-06-29 19:25 ` [PATCH 10/14] block: remove external dependency on wbt_flags Josef Bacik
2018-06-29 19:25 ` [PATCH 11/14] rq-qos: introduce dio_bio callback Josef Bacik
2018-06-29 19:25 ` [PATCH 12/14] block: introduce blk-iolatency io controller Josef Bacik
2018-07-02 21:47   ` Tejun Heo
2018-06-29 19:25 ` [PATCH 13/14] Documentation: add a doc for blk-iolatency Josef Bacik
2018-07-02 21:49   ` Tejun Heo
2018-06-29 19:25 ` Josef Bacik [this message]
2018-07-02 21:13   ` [PATCH 14/14] skip readahead if the cgroup is congested Tejun Heo
2018-07-02 21:26 ` [PATCH 00/14][V5] Introduce io.latency io controller for cgroups Andrew Morton
2018-07-02 21:38   ` Josef Bacik
2018-07-02 21:41   ` Jens Axboe
2018-07-02 21:47     ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2018-07-03 15:14 [PATCH 0/14][V6] " Josef Bacik
2018-07-03 15:15 ` [PATCH 14/14] skip readahead if the cgroup is congested Josef Bacik
2018-06-27 19:09 [PATCH 00/14][V4] Introduce io.latency io controller for cgroups Josef Bacik
2018-06-27 19:09 ` [PATCH 14/14] skip readahead if the cgroup is congested Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180629192542.26649-15-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hannes@cmpxchg.org \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).