No end to swap zone exhausted problems?

David Schultz das at FreeBSD.ORG
Tue Oct 6 19:50:40 UTC 2009


On Fri, Oct 02, 2009, Anders Nordby wrote:
> Better post about my swap zone problems here than tear all my hair out.
> This concerns me:
> 
> 1) How can SWAPMETA usage continue increasing, while swap space used is
> not? Example: http://anders.fupp.net/test/swapmeta.png. In the swap meta
> graph, used space is USED and free space is LIMIT-USED (FREE numbers are
> a bit odd, it starts with 0) from the SWAPMETA line when running vmstat
> -z. In the week graph, you can see that after 3 days swap space usage
> settles at around 90 GB, while swap meta keeps increasing.

IIRC, the swap pager tracks virtual memory regions that include
swapped pages on a granularity of 16 pages.  An increase in
swapmeta usage could simply mean that swap has become fragmented.
It should eventually level out (unless there is actually a leak,
but I think we'd know by now).

> How come increasing maxswzone beyond 256 MB does not yield a larger
> SWAPMETA than 995410? Does it stop around 260 MB maxswzone? How can I
> increase SWAPMETA further to be able to swap more?

The code appears to limit the number of swapmeta entries (each
entry being about 100 bytes) to half the number of pages of
physical memory you have (sys/vm/swap_pager.c):

	n = cnt.v_page_count / 2;
	if (maxswzone && n > maxswzone / sizeof(struct swblock))
		n = maxswzone / sizeof(struct swblock);

You could try commenting out the first two of these lines, leaving
the third, and see if that lets you raise the limit to something
that works better for you.  Note that raising it too high is also
going to cause problems, as all of your physical memory will be
filled with swap metadata.


More information about the freebsd-hackers mailing list