]> git.neil.brown.name Git - history.git/commit
[PATCH] realtime swapspace accounting
authorAndrew Morton <akpm@digeo.com>
Tue, 26 Nov 2002 01:57:13 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 26 Nov 2002 01:57:13 +0000 (17:57 -0800)
commitfbe7559b3563f2c038e3dda9dcc23da210b01896
tree77c66b8cb04d98b6919a804cefdd0d356058411f
parentac3b0460e8eb83d92544862283c1c28cc3846fb0
[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.
include/linux/swap.h
mm/swapfile.c