From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 08:41:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9104106564A; Mon, 5 Sep 2011 08:41:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6F0A8FC17; Mon, 5 Sep 2011 08:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p858fvKl028201; Mon, 5 Sep 2011 08:41:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p858fv66028200; Mon, 5 Sep 2011 08:41:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109050841.p858fv66028200@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 5 Sep 2011 08:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225388 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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 Sep 2011 08:41:57 -0000 Author: kib Date: Mon Sep 5 08:41:57 2011 New Revision: 225388 URL: http://svn.freebsd.org/changeset/base/225388 Log: MFC r225076: Apply the limit to avoid the overflows in the radix tree subr_blist.c after the conversion of the swap device size to the page size units, not before. Modified: stable/8/sys/vm/swap_pager.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/swap_pager.c ============================================================================== --- stable/8/sys/vm/swap_pager.c Mon Sep 5 07:59:23 2011 (r225387) +++ stable/8/sys/vm/swap_pager.c Mon Sep 5 08:41:57 2011 (r225388) @@ -2083,16 +2083,6 @@ swaponsomething(struct vnode *vp, void * u_long mblocks; /* - * If we go beyond this, we get overflows in the radix - * tree bitmap code. - */ - mblocks = 0x40000000 / BLIST_META_RADIX; - if (nblks > mblocks) { - printf("WARNING: reducing size to maximum of %lu blocks per swap unit\n", - mblocks); - nblks = mblocks; - } - /* * nblks is in DEV_BSIZE'd chunks, convert to PAGE_SIZE'd chunks. * First chop nblks off to page-align it, then convert. * @@ -2101,6 +2091,18 @@ swaponsomething(struct vnode *vp, void * nblks &= ~(ctodb(1) - 1); nblks = dbtoc(nblks); + /* + * If we go beyond this, we get overflows in the radix + * tree bitmap code. + */ + mblocks = 0x40000000 / BLIST_META_RADIX; + if (nblks > mblocks) { + printf( + "WARNING: reducing swap size to maximum of %luMB per unit\n", + mblocks / 1024 / 1024 * PAGE_SIZE); + nblks = mblocks; + } + sp = malloc(sizeof *sp, M_VMPGDATA, M_WAITOK | M_ZERO); sp->sw_vp = vp; sp->sw_id = id;