From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Michael Clark <michael@metaparadigm.com>
Cc: linux-kernel@vger.kernel.org, Hugh Dickins <hugh@veritas.com>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [STACK] >3k call path in ide
Date: Wed, 9 Jun 2004 18:29:49 +0200 [thread overview]
Message-ID: <20040609162949.GC29531@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <40C72B68.1030404@metaparadigm.com>
On Wed, 9 June 2004 23:23:20 +0800, Michael Clark wrote:
>
> Noticed that try_to_free_pages, sync_inodes_sb and wakeup_bdflush features
> in almost all of these traces and although at 284, 308 and 256 respectively
> their not huge but together their neither that small (considering they
> occur all in the same stack trace).
>
> This is consumed mostly by a struct page_state which is 148 bytes big
> although looking at the code get_page_state(struct page_state *ret)
> only populates the first 6 fields or 24 bytes. get_full_page_state
> which is hardly used updates these other fields.
>
> Is this a candidate for splitting into 2 structs? 1 containing just the
> first 6 fields needed by the majority of users: try_to_free_pages,
> shrink_all_memory, kswapd, get_dirty_limits, wakeup_bdflush, sync_inodes_sb
Well noticed, although Hugh and Andrew have already exchanged some
patches, see
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0406.1/0134.html
For the moment I consider try_to_free_pages() fixed.
Andrew, what do you thing about the patch below for sync_inodes_sb()?
It's stack consumption is reduced from 308 to 64, at the cost of one
more function call.
Jörn
--
Premature optimization is the root of all evil.
-- Donald Knuth
Move a struct page_state into it's own function. This reduces the stack
consumption for sync_inodes_sb(), as the stack is already partially rolled
back before other functions get called.
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
fs-writeback.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
--- linux-2.6.6cow/fs/fs-writeback.c~sync_inodes_sb 2004-06-09 18:19:25.000000000 +0200
+++ linux-2.6.6cow/fs/fs-writeback.c 2004-06-09 18:23:44.000000000 +0200
@@ -396,6 +396,15 @@
spin_unlock(&inode_lock);
}
+static long get_nr_to_write(void)
+{
+ struct page_state ps;
+
+ get_page_state(&ps);
+ return ps.nr_dirty + ps.nr_unstable + ps.nr_dirty + ps.nr_unstable +
+ (inodes_stat.nr_inodes - inodes_stat.nr_unused);
+}
+
/*
* writeback and wait upon the filesystem's dirty inodes. The caller will
* do this in two passes - one to write, and one to wait. WB_SYNC_HOLD is
@@ -409,7 +418,6 @@
*/
void sync_inodes_sb(struct super_block *sb, int wait)
{
- struct page_state ps;
struct writeback_control wbc = {
.bdi = NULL,
.sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD,
@@ -417,10 +425,7 @@
.nr_to_write = 0,
};
- get_page_state(&ps);
- wbc.nr_to_write = ps.nr_dirty + ps.nr_unstable +
- (inodes_stat.nr_inodes - inodes_stat.nr_unused) +
- ps.nr_dirty + ps.nr_unstable;
+ wbc.nr_to_write = get_nr_to_write();
wbc.nr_to_write += wbc.nr_to_write / 2; /* Bit more for luck */
spin_lock(&inode_lock);
sync_sb_inodes(sb, &wbc);
next prev parent reply other threads:[~2004-06-09 16:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-09 12:29 Jörn Engel
2004-06-09 15:23 ` Michael Clark
2004-06-09 16:29 ` Jörn Engel [this message]
2004-06-09 19:27 ` Andrew Morton
2004-06-10 22:59 ` Jörn Engel
2004-06-10 23:10 ` Andrew Morton
2004-06-11 10:53 ` Jörn Engel
2004-10-15 1:58 ` Rusty Russell
2004-06-15 23:34 ` [PATCH] " Randy.Dunlap
2004-06-16 7:11 ` Florian Schirmer
2004-06-16 9:47 ` Jörn Engel
2004-06-16 9:55 ` Florian Schirmer
2004-06-16 10:00 ` Jörn Engel
2004-06-16 17:37 ` [PATCH] [STACK] reduce " Randy.Dunlap
2004-06-16 17:57 ` Jörn Engel
2004-06-16 18:16 ` Randy.Dunlap
2004-06-16 18:29 ` Jörn Engel
2004-06-16 18:49 ` Randy.Dunlap
2004-06-16 18:58 ` Brian Gerst
2004-06-16 19:52 ` Randy.Dunlap
2004-06-16 22:53 ` Randy.Dunlap
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=20040609162949.GC29531@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@metaparadigm.com \
/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
all inboxes | Powered by JetHome®