From owner-freebsd-hackers Tue Jan 30 16:31:11 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.gmx.net (pop.gmx.de [194.221.183.20]) by hub.freebsd.org (Postfix) with SMTP id 68A2D37B6A0 for ; Tue, 30 Jan 2001 16:30:53 -0800 (PST) Received: (qmail 22071 invoked by uid 0); 31 Jan 2001 00:30:51 -0000 Received: from p3e9bc28c.dip.t-dialin.net (HELO forge.local) (62.155.194.140) by mail.gmx.net (mp004-rz3) with SMTP; 31 Jan 2001 00:30:51 -0000 Received: from thomas by forge.local with local (Exim 3.16 #1 (Debian)) id 14NlAf-0000cK-00; Wed, 31 Jan 2001 01:30:49 +0100 Date: Wed, 31 Jan 2001 01:30:49 +0100 From: Thomas Moestl To: Matt Dillon Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: removing setgid kmem from top, collecting per-device swap stats Message-ID: <20010131013049.A2368@crow.dom2ip.de> Mail-Followup-To: Thomas Moestl , Matt Dillon , freebsd-hackers@FreeBSD.ORG References: <20010130224759.A1589@crow.dom2ip.de> <200101302321.f0UNLcB95520@earth.backplane.com> <20010131005923.A2199@crow.dom2ip.de> <200101310017.f0V0Htr96647@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101310017.f0V0Htr96647@earth.backplane.com>; from dillon@earth.backplane.com on Tue, Jan 30, 2001 at 04:17:55PM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Jan 30, 2001 at 04:17:55PM -0800, Matt Dillon wrote: > > : 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 > > Hmm. I think it would be easier to figure it out in the swap > allocation and free code. Specifically, look in vm/swap_pager.c: > > * The swp_pager_getswapspace() function > * The swp_pager_freeswapspace() function > > I think these are the best places to keep track of per-swap-area > allocation and frees. Note that the system tracks overall swap > useage in these routines as well (the vm_swap_size global). Yep. I only thought I should keep the layering by using VOPs. But you are right, swap_pager and vm_swap are dependent anyway, so this can be justified, and things are not duplicated over the whole file. So, is it OK with you if I do it the way you described? - thomas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message