Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Dec 1999 15:36:54 -0600 (CST)
From:      Ryan Thompson <freebsd@sasknow.com>
To:        freebsd-hackers@freebsd.org
Subject:   Default minfree performance restrictions?
Message-ID:  <Pine.BSF.4.10.9912201504420.30072-100000@sasknow.com>

next in thread | raw e-mail | index | archive | help
Hello all,

After creating some larger slices than I'm used to, I finally felt the
full force of a default 8% minfree setting.  So, I went to tunefs(8) to
try and put a damper on the multiple gigabytes that aren't being made
available to users.  However, I was a bit disappointed to note that
setting minfree at or below 5% (using integer values!) would result in
SPACE optimization.

So, on my 3.4-STABLE system, I did some hunting around.

In /usr/src/sys/ufs/ffs/fs.h, I see MINFREE defaults to 8%, and default
time optimization, like tunefs says.  Nothing fancy, there.

In ./ffs_alloc.c, however, I found out how the SPACE/TIME optimization is
determined.  In particular, in ffs_realloccg(), I find (from yesterday's
-STABLE), the following snippet:

	/*
	 * Allocate a new disk location.
	 */
	if (bpref >= fs->fs_size)
		bpref = 0;
	switch ((int)fs->fs_optim) {
	case FS_OPTSPACE:
		/*
		 * Allocate an exact sized fragment. Although this makes
		 * best use of space, we will waste time relocating it if
		 * the file continues to grow. If the fragmentation is
		 * less than half of the minimum free reserve, we choose
		 * to begin optimizing for time.
		 */
		request = nsize;
		if (fs->fs_minfree <= 5 ||      /* !!! */
		    fs->fs_cstotal.cs_nffree >
		    fs->fs_dsize * fs->fs_minfree / (2 * 100))
			break;
		log(LOG_NOTICE, "%s: optimization changed from SPACE to TIME\n",
			fs->fs_fsmnt);
		fs->fs_optim = FS_OPTTIME;
		break;

Questions:

 - Can the line I've marked /* !!! */ have the minimum value of 5 safely
reduced? Eliminated? (safely = if/when a filesystem fills up, could writes
potentially corrupt the fs?) On small partitions with many inodes, perhaps
5% is appropriate, but in cases like mine, where I have filesystems in
excess of 20GB with < 0.1% fragmentation, > 5% minfree is frankly too much
to give away.

 - Would it make sense to externalize this option into a header file,
kernel config option, or perhaps tunefs itself?  I'm guessing the latter
would require modifications to our UFS implementation to allow for the
extra parameter for each filesystem... And would definitely qualify as an
"invasive" change.  Food for thought, though :-)

Any insights?

I suppose I could just go ahead and try it, but, before I end up doing a
reinstall (cd /usr/src && make blowupworld), I thought it better to ask a
more experienced following of users :-)

--
  Ryan Thompson <ryan@sasknow.com>
  50% Owner, Technical and Accounts
  Phone: +1 (306) 664-1161

  SaskNow Technologies     http://www.sasknow.com
  #106-380 3120 8th St E   Saskatoon, SK  S7H 0W2



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9912201504420.30072-100000>