From owner-svn-src-user@FreeBSD.ORG Tue Feb 25 12:13:12 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BA0F291; Tue, 25 Feb 2014 12:13:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 58B751228; Tue, 25 Feb 2014 12:13:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1PCDCKT091579; Tue, 25 Feb 2014 12:13:12 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1PCDCgL091578; Tue, 25 Feb 2014 12:13:12 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201402251213.s1PCDCgL091578@svn.freebsd.org> From: Peter Holm Date: Tue, 25 Feb 2014 12:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r262479 - user/pho/stress2/testcases/swap X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Feb 2014 12:13:12 -0000 Author: pho Date: Tue Feb 25 12:13:11 2014 New Revision: 262479 URL: http://svnweb.freebsd.org/changeset/base/262479 Log: Recalculate how much memory should be used for page stealing, specifically for hosts without a swap disk. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/testcases/swap/swap.c Modified: user/pho/stress2/testcases/swap/swap.c ============================================================================== --- user/pho/stress2/testcases/swap/swap.c Tue Feb 25 09:34:30 2014 (r262478) +++ user/pho/stress2/testcases/swap/swap.c Tue Feb 25 12:13:11 2014 (r262479) @@ -37,9 +37,14 @@ __FBSDID("$FreeBSD$"); #include #include - #include "stress.h" +#if defined(__LP64__) +#define MINLEFT (1792LL * 1024 * 1024) +#else +#define MINLEFT (1024LL * 1024 * 1024) +#endif + static unsigned long size; int @@ -53,25 +58,33 @@ setup(int nb) if (nb == 0) { mem = usermem(); swapinfo = swap(); - if (swapinfo > (int64_t)mem) - swapinfo = mem; if (op->hog == 0) - pct = random_int(1, 10); + pct = random_int(80, 100); if (op->hog == 1) - pct = random_int(10, 20); + pct = random_int(100, 110); if (op->hog == 2) - pct = random_int(80, 90); + pct = random_int(110, 120); if (op->hog >= 3) - pct = random_int(100, 110); + pct = random_int(120, 130); - if (swapinfo == 0) + if (swapinfo == 0) { + if (mem <= MINLEFT) + _exit(1); + mem -= MINLEFT; + if (pct > 100) + pct = 100; + size = mem / 100 * pct; + } else { size = mem / 100 * pct; - else - size = swapinfo / 100 * pct + mem; + if (size > mem + swapinfo / 4) { + size = mem + swapinfo / 4; + pct = size * 100 / mem; + } + } size = size / op->incarnations;