From: Daniel Phillips <phillips@phunq.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC] [PATCH] A clean approach to writeout throttling
Date: Thu, 6 Dec 2007 12:04:14 -0800 [thread overview]
Message-ID: <200712061204.14854.phillips@phunq.net> (raw)
In-Reply-To: <20071206035511.83bef995.akpm@linux-foundation.org>
On Thursday 06 December 2007 03:55, Andrew Morton wrote:
> Consider an example.
>
> - We a-priori decide to limit a particular stack's peak memory usage
> to 1MB
Ah, this is the piece I was missing.
> - We empirically discover that the maximum amount of memory which is
> allocated by that stack on behalf of a single BIO is 16kb. (ie:
> that's the most it has ever used for a single BIO).
>
> - Now, we refuse to feed any more BIOs into the stack when its
> instantaneous memory usage exceeds (1MB - 16kb).
And printk a warning, because the programmer's static analysis was
wrong.
> Of course, the _average_ memory-per-BIO is much less than 16kb. So
> there are a lot of BIOs in flight - probably hundreds, but a minimum
> of 63.
And progress is being made, everybody is happy.
> There is a teeny so-small-it-doesn't-matter chance that the stack
> will exceed the 1MB limit. If it happens to be at its (1MB-16kb)
> limit and all the memory in the machine is AWOL and then someone
> throws a never-seen-before twirly BIO at it. Not worth worrying
> about, surely.
OK, I see where you are going. The programmer statically determines a
total reservation for the stack, which is big enough that progress is
guaranteed. We then throttle based on actual memory consumption, and
essentially use a heuristic to decide when we are near the upper limit.
Workable I think, but...
The main idea, current->pages_used_for_block_allocations++ is valid only
in direct call context. If a daemon needs to allocate memory on behalf
of the IO transfer (not unusual) it won't get accounted, which is
actually the central issue in this whole class of deadlocks. Any idea
how to extend the accounting idea to all tasks involved in a particular
block device stack?
Regards,
Daniel
next prev parent reply other threads:[~2007-12-06 20:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 0:03 [RFC] [PATCH] A clean approach to writeout throttling Daniel Phillips
2007-12-06 1:24 ` Andrew Morton
2007-12-06 6:21 ` Daniel Phillips
2007-12-06 7:31 ` Andrew Morton
2007-12-06 9:48 ` Daniel Phillips
2007-12-06 11:55 ` Andrew Morton
2007-12-06 15:52 ` Rik van Riel
2007-12-06 17:34 ` Andrew Morton
2007-12-06 17:48 ` Rik van Riel
2007-12-06 20:04 ` Daniel Phillips [this message]
2007-12-06 20:27 ` Andrew Morton
2007-12-06 21:27 ` Daniel Phillips
2007-12-06 21:53 ` Bill Davidsen
2007-12-07 0:04 ` Daniel Phillips
2007-12-07 0:29 ` Andrew Morton
2007-12-07 7:13 ` Daniel Phillips
2007-12-10 9:20 ` Daniel Phillips
2007-12-10 10:47 ` Jens Axboe
2007-12-10 11:23 ` [RFC] [PATCH] A clean aEvgeniy pproach " Daniel Phillips
2007-12-10 11:41 ` Jens Axboe
2007-12-10 12:13 ` Daniel Phillips
2007-12-10 12:16 ` Jens Axboe
2007-12-10 12:27 ` Daniel Phillips
2007-12-10 12:32 ` Jens Axboe
2007-12-10 13:04 ` Daniel Phillips
2007-12-10 13:19 ` Jens Axboe
2007-12-10 13:26 ` Daniel Phillips
2007-12-10 13:30 ` Jens Axboe
2007-12-10 13:43 ` Daniel Phillips
2007-12-10 13:53 ` Jens Axboe
2007-12-10 14:17 ` Daniel Phillips
2007-12-11 13:15 ` Jens Axboe
2007-12-11 19:38 ` Daniel Phillips
2007-12-11 20:01 ` Jens Axboe
2007-12-11 20:11 ` Daniel Phillips
2007-12-11 20:07 ` Daniel Phillips
2007-12-10 11:33 ` [RFC] [PATCH] A clean approach " Daniel Phillips
2007-12-10 21:31 ` Jonathan Corbet
2007-12-10 22:06 ` Pekka Enberg
2007-12-11 4:21 ` Daniel Phillips
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=200712061204.14854.phillips@phunq.net \
--to=phillips@phunq.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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).