From: Artem Bityutskiy <dedekind1@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH 00/16] kill unnecessary bdi wakeups + cleanups
Date: Fri, 16 Jul 2010 15:44:56 +0300 [thread overview]
Message-ID: <1279284312-2411-1-git-send-email-dedekind1@gmail.com> (raw)
Hi,
here is a series of patches which lessens amount of unnecessary wake-ups in
the linux kernel.
THE PROBLEM
~~~~~~~~~~~
Each block device has corresponding "flusher" thread, which are usually seen
as "flusher-x:y" in your 'ps' output. Flusher threads are responsible to do
background write-back for different kernel code paths like memory reclamation
as well as the periodic background writeout.
The flusher threads wake up every 5 seconds and check whether they have to
write anything back or not. In idle systems with good dynamic power-management
this means that they force it to wake up from deep sleep, find out that there
is nothing to do, and waste power. This hurts small battery-powered devices,
e.g., linux-based phones.
But idle wake-ups do not last forever, the bdi threads kill themselves if
nothing useful has been done for 5 minutes.
Also, there is the bdi forker thread, seen as 'bdi-default' in your 'ps'
output. This thread also wakes up every 5 seconds and checks whether it has to
fork a bid flusher thread, in case there is dirt to write-back, but the thread
was killed. This is also bad for battery-powered embedded devices.
SOLUTION
~~~~~~~~
This patch set makes bdi threads and the forker thread wake-up only if there is
job to do, otherwise they will sleep. The main idea is to wake-up the needed
thread when adding dirty data to the bdi.
To implement this:
1. I address various rare race conditions in the current code.
2. Then I move the killing logic from bdi threads to the forker thread, so that
we would have one central place where we make decisions about killing inactive
bdi threads. The reason I do this is because otherwise it is difficult to make
sure that a bdi thread does not decide to exit while you are waking it up.
3. I add a small piece of code to '__mark_inode_dirt()' which wakes up the bdi
thread when dirty inodes arrive
4. There are also clean-up patches and nicification patches which I found to be
good for better code readability.
5. Some patches are just preparations which make the following real patches
simpler and easier to review.
6. Some patches are just simplifications of current code.
With this patchset bdi threads wake up considerably less.
This is RFC so far, because:
1. I'm new to this area
2. patches really need review
3. patches need more testing and polishing
Side note, there is another set of patches which are solving a similar problem
waiting for comments/acceptance:
http://thread.gmane.org/gmane.linux.file-systems/42834
Artem.
next reply other threads:[~2010-07-16 12:49 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 12:44 Artem Bityutskiy [this message]
2010-07-16 12:44 ` [RFC][PATCH 01/16] writeback: do not self-wakeup Artem Bityutskiy
2010-07-18 6:44 ` Christoph Hellwig
2010-07-18 9:43 ` Artem Bityutskiy
2010-07-16 12:44 ` [RFC][PATCH 02/16] writeback: remove redundant list initialization Artem Bityutskiy
2010-07-18 6:44 ` Christoph Hellwig
2010-07-16 12:44 ` [RFC][PATCH 03/16] writeback: harmonize writeback threads naming Artem Bityutskiy
2010-07-18 6:45 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 04/16] writeback: fix possible race when shutting down bdi Artem Bityutskiy
2010-07-18 6:47 ` Christoph Hellwig
2010-07-20 8:58 ` Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 05/16] writeback: fix possible race when creating bdi threads Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 06/16] writeback: improve bdi_has_dirty_io Artem Bityutskiy
2010-07-18 6:49 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 07/16] writeback: do not lose wake-ups in the forker thread Artem Bityutskiy
2010-07-18 6:49 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 08/16] writeback: do not lose default bdi wake-ups Artem Bityutskiy
2010-07-18 6:52 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 09/16] writeback: do not lose wake-ups in bdi threads Artem Bityutskiy
2010-07-18 6:52 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 10/16] writeback: simplify bdi code a little Artem Bityutskiy
2010-07-18 6:56 ` Christoph Hellwig
2010-07-20 10:34 ` Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 11/16] writeback: move last_active to bdi Artem Bityutskiy
2010-07-18 7:03 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 12/16] writeback: add to bdi_list in the forker thread Artem Bityutskiy
2010-07-18 6:58 ` Christoph Hellwig
2010-07-20 11:07 ` Artem Bityutskiy
2010-07-20 11:32 ` Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 13/16] writeback: restructure bdi forker loop a little Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 14/16] writeback: move bdi threads exiting logic to the forker thread Artem Bityutskiy
2010-07-18 7:02 ` Christoph Hellwig
2010-07-20 12:23 ` Artem Bityutskiy
2010-07-20 12:54 ` Artem Bityutskiy
2010-07-16 12:45 ` [RFC][PATCH 15/16] writeback: clean-up the warning about non-registered bdi Artem Bityutskiy
2010-07-18 7:03 ` Christoph Hellwig
2010-07-16 12:45 ` [RFC][PATCH 16/16] writeback: prevent unnecessary bdi threads wakeups Artem Bityutskiy
2010-07-18 7:45 ` Christoph Hellwig
2010-07-20 13:13 ` Artem Bityutskiy
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=1279284312-2411-1-git-send-email-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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).