summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2002-11-25 17:57:13 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-11-25 17:57:13 -0800
commitfbe7559b3563f2c038e3dda9dcc23da210b01896 (patch)
tree77c66b8cb04d98b6919a804cefdd0d356058411f /include
parentac3b0460e8eb83d92544862283c1c28cc3846fb0 (diff)
[PATCH] realtime swapspace accounting
There are a couple of statistical functions which scan the entire swap map counting things up, to display in /proc. On my machine, these hold spinlocks for 19 milliseconds which is unacceptable from a scheduling latency point of view. And an application which sits in a loop reading /proc/swaps on a large machine is probably a decent denial-of-service attack - it will limit swap allocations to tens of pages per second. So add a counter to swap_info_struct and use it to track how many pages are currently in use, so those reporting functions don't need to add them all up.
Diffstat (limited to 'include')
-rw-r--r--include/linux/swap.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 8ad50c284b45..d74f0800ab32 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -121,6 +121,7 @@ struct swap_info_struct {
int prio; /* swap priority */
int pages;
unsigned long max;
+ unsigned long inuse_pages;
int next; /* next entry on swap list */
};