Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Feb 2001 16:18:37 +0900
From:      "Akinori MUSHA" <knu@iDaemons.org>
To:        Matt Dillon <dillon@FreeBSD.org>, sanpei@FreeBSD.org
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/i386/linux linux_machdep.c
Message-ID:  <86u25fxoky.wl@archon.local.idaemons.org>
In-Reply-To: <200102280430.f1S4UST14589@freefall.freebsd.org>
References:  <200102280430.f1S4UST14589@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
At Tue, 27 Feb 2001 20:30:28 -0800 (PST),
dillon wrote:
> dillon      2001/02/27 20:30:28 PST
> 
>   Modified files:
>     sys/i386/linux       linux_machdep.c 
>   Log:
>   Linux does not filesystem-sync file-backed writable mmap pages on
>   a regular basis.  Adjust our linux emulation to conform.  This will
>   cause more dirty pages to be left for the pagedaemon to deal with,
>   but our new low-memory handling code can deal with it.   The linux
>   way appears to be a trend, and we may very well make MAP_NOSYNC the
>   default for FreeBSD as well (once we have reasonable sequential
>   write-behind heuristics for random faults).
>   (will be MFC'd prior to 4.3 freeze)
>   
>   Suggested by: Andrew Gallatin

How does it compare to the attached patch which came up in the
FreeBSD-users-jp mailing list in Japan some time ago?

It gives users an option to switch the behavior via sysctl(8), and
does <<bsd_args.flags |= MAP_NOSYNC;>> in a different place.

The patch was originally posted by sanpei@FreeBSD.org, and is
mentioned in Hints.FreeBSD of the vmware2 port, FYI.

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"We're only at home when we're on the run, on the wing, on the fly"

--- sys/i386/linux/linux_machdep.c	2001/02/16 16:40:43	1.12
+++ sys/i386/linux/linux_machdep.c	2001/02/27 15:37:29
@@ -31,6 +31,7 @@
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <sys/proc.h>
+#include <sys/sysctl.h>
 #include <sys/sysproto.h>
 #include <sys/systm.h>
 #include <sys/unistd.h>
@@ -288,6 +289,11 @@
 	int pos;
 };
 
+static int mmap_nosync;
+SYSCTL_DECL(_compat_linux);
+SYSCTL_INT(_compat_linux, OID_AUTO, mmap_nosync, CTLFLAG_RW,
+	&mmap_nosync, 0, "mmap files with MAP_NOSYNC flag in Linux mode.");
+
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
 
@@ -395,8 +401,11 @@
 	bsd_args.prot = linux_args.prot | PROT_READ;	/* always required */
 	if (linux_args.flags & LINUX_MAP_ANON)
 		bsd_args.fd = -1;
-	else
+	else {
 		bsd_args.fd = linux_args.fd;
+		if (mmap_nosync)
+			bsd_args.flags |= MAP_NOSYNC;
+	}
 	bsd_args.pos = linux_args.pos;
 	bsd_args.pad = 0;
 

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86u25fxoky.wl>