From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Jens Axboe <axboe@suse.de>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] possible rq starvation on oom
Date: Thu, 13 Jan 2005 21:45:07 +1100 [thread overview]
Message-ID: <41E65133.6060107@yahoo.com.au> (raw)
In-Reply-To: <20050113092246.GJ2815@suse.de>
Jens Axboe wrote:
> Hi,
>
> I stumbled across this the other day. The block layer only uses a single
> memory pool for request allocation, so it's very possible for eg writes
> to have allocated them all at any point in time. If that is the case and
> the machine is low on memory, a reader attempting to allocate a request
> and failing in blk_alloc_request() can get stuck for a long time since
> no one is there to wake it up.
>
Yeah, this would do it for sure. Nice work Jens.
Actually, this could block up requests indefinitely couldn't it?
> The solution is either to add the extra mempool so both reads and writes
> have one, or attempt to handle the situation. I chose the latter, to
> save the extra memory required for the additional mempool with
> BLKDEV_MIN_RQ statically allocated requests per-queue.
>
> If a read allocation fails and we have no readers in flight for this
> queue, mark us rq-starved so that the next write being freed will wake
> up the sleeping reader(s). Same situation would happen for writes as
> well of course, it's just a lot more unlikely.
>
I wonder... could you put failed, starved readers on the writer's
waitqueue and vice versa? AFAIKS this would eliminate special casing
in the fast paths, and also hopefully preserve process ordering.
But either way, it looks like your patch should do the trick as well.
Nick
next prev parent reply other threads:[~2005-01-13 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 9:22 [PATCH] possible rq starvation on oom Jens Axboe
2005-01-13 10:45 ` Nick Piggin [this message]
2005-01-13 11:01 ` Jens Axboe
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=41E65133.6060107@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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