From: Craig Christophel <merlin@transgeek.com>
To: linux-kernel@vger.kernel.org
Subject: shrink_caches inconsistancy
Date: Wed, 5 Dec 2001 17:09:54 -0500 [thread overview]
Message-ID: <20011205180526.DCB78C7382@smtp.transgeek.com> (raw)
This patch makes the comments match for icache,dcache,dqcache shrink
functions. Initially the comment stated that a priority of 0 could be used,
but after looking into mm/vmscan.c::shrink_caches this cannot be true. So
the comment now states that 1 is the highest priority. This appears __really
true as at priority 1 all of the cache possible is removed.
Also shrink_dqcache_memory now uses the count variable like everyone else.
Possibly incorrect __GFP_FS check added to the dqcache function. but again
consistancy is my goal.
Another dqcache issue in that the dqcache was being shrunk at priority+1
rather than at priority, this looked suspect, and with no comment around the
code, it to has been remanded to consistancy.
Well, here goes. Any comments and/or b#$chslaps welcome. This is my first
attempted patch after studying the VFS layer for a while, so please be
(fairly) kind.
Craig.
diff -urN linux/fs/dcache.c linux.mt/fs/dcache.c
--- linux/fs/dcache.c Sat Dec 1 17:21:03 2001
+++ linux.mt/fs/dcache.c Wed Dec 5 16:13:38 2001
@@ -543,7 +543,7 @@
* too much.
*
* Priority:
- * 0 - very urgent: shrink everything
+ * 1 - very urgent: shrink everything
* ...
* 6 - base-level: try to shrink a bit.
*/
diff -urN linux/fs/dquot.c linux.mt/fs/dquot.c
--- linux/fs/dquot.c Thu Nov 22 13:38:31 2001
+++ linux.mt/fs/dquot.c Wed Dec 5 17:07:23 2001
@@ -407,11 +407,30 @@
head = free_dquots.prev;
}
}
+/*
+ * This is called from kswapd when we think we need some
+ * more memory, but aren't really sure how much. So we
+ * carefully try to free a _bit_ of our dqcache, but not
+ * too much.
+ *
+ * Priority:
+ * 1 - very urgent: shrink everything
+ * ...
+ * 6 - base-level: try to shrink a bit.
+ */
int shrink_dqcache_memory(int priority, unsigned int gfp_mask)
{
+ int count = 0;
+
lock_kernel();
- prune_dqcache(nr_free_dquots / (priority + 1));
+
+ if (!(gfp_mask & __GFP_FS))
+ return 0;
+
+ count = nr_free_dquots / priority;
+
+ prune_dqcache(count);
unlock_kernel();
kmem_cache_shrink(dquot_cachep);
return 0;
diff -urN linux/fs/inode.c linux.mt/fs/inode.c
--- linux/fs/inode.c Sat Dec 1 17:21:03 2001
+++ linux.mt/fs/inode.c Wed Dec 5 16:37:25 2001
@@ -707,7 +707,17 @@
if (goal)
schedule_task(&unused_inodes_flush_task);
}
-
+/*
+ * This is called from kswapd when we think we need some
+ * more memory, but aren't really sure how much. So we
+ * carefully try to free a _bit_ of our icache, but not
+ * too much.
+ *
+ * Priority:
+ * 1 - very urgent: shrink everything
+ * ...
+ * 6 - base-level: try to shrink a bit.
+ */
int shrink_icache_memory(int priority, int gfp_mask)
{
int count = 0;
next reply other threads:[~2001-12-05 22:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-05 22:09 Craig Christophel [this message]
2001-12-06 11:16 ` Jan Kara
2001-12-06 15:11 ` Craig Christophel
2001-12-05 22:49 Craig Christophel
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=20011205180526.DCB78C7382@smtp.transgeek.com \
--to=merlin@transgeek.com \
--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
all inboxes | Powered by JetHome®