From owner-svn-src-all@freebsd.org Mon Jun 5 17:14:18 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ABB5AFD874; Mon, 5 Jun 2017 17:14:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69EBD2D48; Mon, 5 Jun 2017 17:14:18 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v55HEHfk012144; Mon, 5 Jun 2017 17:14:17 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v55HEHff012141; Mon, 5 Jun 2017 17:14:17 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201706051714.v55HEHff012141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 5 Jun 2017 17:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319604 - in head/sys: kern sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2017 17:14:18 -0000 Author: alc Date: Mon Jun 5 17:14:16 2017 New Revision: 319604 URL: https://svnweb.freebsd.org/changeset/base/319604 Log: Halve the memory being internally allocated by the blist allocator. In short, half of the memory that is allocated to implement the radix tree is wasted because we did not change "u_daddr_t" to be a 64-bit unsigned int when we changed "daddr_t" to be a 64-bit (signed) int. (See r96849 and r96851.) Reviewed by: kib, markj Tested by: pho MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D11028 Modified: head/sys/kern/subr_blist.c head/sys/sys/blist.h head/sys/vm/swap_pager.c Modified: head/sys/kern/subr_blist.c ============================================================================== --- head/sys/kern/subr_blist.c Mon Jun 5 17:05:06 2017 (r319603) +++ head/sys/kern/subr_blist.c Mon Jun 5 17:14:16 2017 (r319604) @@ -366,7 +366,7 @@ blst_leaf_alloc( j >>= 1; mask >>= j; } - scan->u.bmu_bitmap &= ~(1 << r); + scan->u.bmu_bitmap &= ~((u_daddr_t)1 << r); return(blk + r); } if (count <= BLIST_BMAP_RADIX) { @@ -658,7 +658,7 @@ static void blst_copy( int i; for (i = 0; i < BLIST_BMAP_RADIX && i < count; ++i) { - if (v & (1 << i)) + if (v & ((u_daddr_t)1 << i)) blist_free(dest, blk + i, 1); } } Modified: head/sys/sys/blist.h ============================================================================== --- head/sys/sys/blist.h Mon Jun 5 17:05:06 2017 (r319603) +++ head/sys/sys/blist.h Mon Jun 5 17:14:16 2017 (r319604) @@ -44,7 +44,7 @@ * ops. * * SWAPBLK_NONE is returned on failure. This module is typically - * capable of managing up to (2^31) blocks per blist, though + * capable of managing up to (2^63) blocks per blist, though * the memory utilization would be insane if you actually did * that. Managing something like 512MB worth of 4K blocks * eats around 32 KBytes of memory. @@ -56,7 +56,7 @@ #ifndef _SYS_BLIST_H_ #define _SYS_BLIST_H_ -typedef u_int32_t u_daddr_t; /* unsigned disk address */ +typedef uint64_t u_daddr_t; /* unsigned disk address */ /* * note: currently use SWAPBLK_NONE as an absolute value rather then Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Jun 5 17:05:06 2017 (r319603) +++ head/sys/vm/swap_pager.c Mon Jun 5 17:14:16 2017 (r319604) @@ -116,9 +116,8 @@ __FBSDID("$FreeBSD$"); #include /* - * SWB_NPAGES must be a power of 2. It may be set to 1, 2, 4, 8, 16 - * or 32 pages per allocation. - * The 32-page limit is due to the radix code (kern/subr_blist.c). + * MAX_PAGEOUT_CLUSTER must be a power of 2 between 1 and 64. + * The 64-page limit is due to the radix code (kern/subr_blist.c). */ #ifndef MAX_PAGEOUT_CLUSTER #define MAX_PAGEOUT_CLUSTER 16