From owner-freebsd-hackers Fri Jul 12 23:52:22 2002 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 0B62837B400 for ; Fri, 12 Jul 2002 23:52:19 -0700 (PDT) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id B122D43E5E for ; Fri, 12 Jul 2002 23:52:18 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.4) with ESMTP id g6D6qILA076723; Fri, 12 Jul 2002 23:52:18 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.4/Submit) id g6D6qI93076722; Fri, 12 Jul 2002 23:52:18 -0700 (PDT) (envelope-from dillon) Date: Fri, 12 Jul 2002 23:52:18 -0700 (PDT) From: Matthew Dillon Message-Id: <200207130652.g6D6qI93076722@apollo.backplane.com> To: David Schultz Cc: Sean Kelly , hackers@FreeBSD.ORG Subject: Re: swapoff? References: <20020713040247.GA82181@edgemaster.zombie.org> <20020713052337.GA662@HAL9000.wox.org> <20020713053236.GA884@HAL9000.wox.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :BTW, NetBSD's new UVM code has the ability to do this. Perhaps :it's worth looking in to how difficult it would really be in FreeBSD... : :To Unsubscribe: send mail to majordomo@FreeBSD.org :with "unsubscribe freebsd-hackers" in the body of the message Someone got it mostly working a year or two ago if I remember right but I don't know what happened to it finally. Implementing swapoff is a bunch of grunt-work but not too hard in concept. Basically the work involved is this: * Make a calculation to be sure that it is possible to turn off the swap device and not run the system out of VM. If it is not possible do not allow the swapoff. * Allocate all the free bitmap bits related to the swap device you are trying to remove to prevent pageouts to the device you are removing. * Flag the swap device being removed and then scan all OBJT_SWAP VM Objects looking for swap blocks associated with the device, and force a page-in of those blocks. The getpages code for the swap backing store would detect the flag and not clear the swap bitmap bits as it pages-in the data. (Forcing a pagein may force pages to cycle back out to another swap device, so special treatment of the paged-in pages (like immediately placing it in the VM page cache instead of the active or inactive queues) is necessary to reduce load effects on the system. * The swap device being removed can now be closed and the related swap device index marked free. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message