Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jan 2001 00:59:23 +0100
From:      Thomas Moestl <tmoestl@gmx.net>
To:        Matt Dillon <dillon@earth.backplane.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: removing setgid kmem from top, collecting per-device swap stats
Message-ID:  <20010131005923.A2199@crow.dom2ip.de>
In-Reply-To: <200101302321.f0UNLcB95520@earth.backplane.com>; from dillon@earth.backplane.com on Tue, Jan 30, 2001 at 03:21:38PM -0800
References:  <20010130224759.A1589@crow.dom2ip.de> <200101302321.f0UNLcB95520@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 30, 2001 at 03:21:38PM -0800, Matt Dillon wrote:
> :vm.swapdev1.total  (this is the one that is currently hard to get)
>     You can't move swapinfo into the kernel as a sysctl unless you
>     solve this problem.  Traversing the radix tree is expensive enough
>     that the entire system will stall for a short period of time if you run
>     the loop in the kernel.
Yes. I did not have that in mind.

>     The issue here is that swapinfo tries to break the useage down by
>     swap area, whereas the kernel has no real concept of swap areas
>     in the allocation map -- it just sees one big contiguous allocation
>     map.  So the kernel does not track allocations on a per-swap-area
>     basis.
My thought was the following: add a swapaccount vnode operation, and
then do (in flushchainbuf):
		VOP_SWAPACCOUNT(nbp->b_vp, nbp);
		BUF_KERNPROC(nbp);
		BUF_STRATEGY(nbp);

Now, I have to define the vop in vm_swap.c, where I can get the area
index from the block number in a clean way and frob my counters.
The same method could be used in swap_pager_putpages(). 
swap_pager_reserve() would need to construct a buf and act in a similar
way as e.g. swap_pager_strategy(), only that the buffer is not flushed
afterwards, only VOP_SWAPACCOUNT is called. Of course, this can be
done much easier by just passing the block number to VOP_SWAPACCOUNT,
and calling it for each blk returned by swp_pager_getswapspace()
(it costs virtually nothing, so it should be OK).
So, VOP_SWAPACCOUNT would become:
		VOP_SWAPACCOUNT(nbp->b_vp, nbp->b_blkno, nbp->bcount);

Or did I get things wrong?

	- thomas



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010131005923.A2199>