From owner-freebsd-hackers@FreeBSD.ORG Thu May 22 08:46:19 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBCD837B404 for ; Thu, 22 May 2003 08:46:19 -0700 (PDT) Received: from puffin.mail.pas.earthlink.net (puffin.mail.pas.earthlink.net [207.217.120.139]) by mx1.FreeBSD.org (Postfix) with ESMTP id 536F443F93 for ; Thu, 22 May 2003 08:46:19 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38ldva3.dialup.mindspring.com ([209.86.253.67] helo=mindspring.com) by puffin.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19IsGm-0006Wn-00; Thu, 22 May 2003 08:46:17 -0700 Message-ID: <3ECCF083.A6CA789F@mindspring.com> Date: Thu, 22 May 2003 08:45:07 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Peter Edwards References: <20030521180222.0FA3343F3F@mx1.FreeBSD.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a48f4af97021f58dc4f89bea104193879fa7ce0e8f8d31aa3f350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: Question on (ab)using the swap pager and VM X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2003 15:46:20 -0000 Peter Edwards wrote: > What I'm less sure about is how to write to the swap pager. My best guess > is that I can modify the page with impunity once it's wired, then > do something like what vm_proc_swapout() does, calling vm_page_dirty() > and vm_page_unwire() to put it back on to the correct queue, where the > swapper can launder it if neccessary. > > Overall, can I do something like this to allocate and write a single > page to the swap pager? (modulo locking stuff) Just allocate pageable kernel memory. There's a function to do that, though it's not often used. When you want to swap something out, let the VM decide to do it for you: it's smarter than your policy enforcement routine. So just dirty the page, and let it happen automatically. You will need to make your FS able to pause in case of page faults, so you will have to be very careful, internally, about locking. And yes, it's a criminal thing to do... you will be eating KVA mappings for the pages. 8-). You are better off considering a kernel process (not thread) to give it a seperate address space from the kernel's KVA, and doing your operations in that address space instead. That will decrease KVA pressure from your evil scheme, and will increase the size of the FS you can back this way. -- Terry