From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 28 13:02:37 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C916216A4CF for ; Sun, 28 Mar 2004 13:02:37 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82C2E43D2F for ; Sun, 28 Mar 2004 13:02:37 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i2SL2b2j024492; Sun, 28 Mar 2004 15:02:37 -0600 (CST) (envelope-from dan) Date: Sun, 28 Mar 2004 15:02:37 -0600 From: Dan Nelson To: Mark Terribile Message-ID: <20040328210236.GM3446@dan.emsphone.com> References: <20040327195505.13415.qmail@web21113.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040327195505.13415.qmail@web21113.mail.yahoo.com> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: freebsd-hackers@freebsd.org Subject: Re: MS_ASYNC with MS_INVALIDATE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Mar 2004 21:02:37 -0000 In the last episode (Mar 27), Mark Terribile said: > A friend asked me to run some Linux source on FreeBSD. It simulates > a data pool management system he is using, and it includes a call > msync(2) with both the MS_ASYNC and MS_INVALIDATE flags. FreeBSD > does not allow this. (I tested it on my 4.8 system; I'll have access > to a 5.1 system on Monday.) I ran it without the MS_ASYNC, and got > very different results from the ones he reported on Linux. I'd like > to be able to explain what's happening. > > Would someone please shed some light on why this combination of flags > is disallowed, and what the intended semantics are? I suspect that > either I or he has a subtle misunderstanding here. Does that even make sense? How could you simultaneously request that all modified pages be queued for writing to disk AND that all modified pages be discarded? If you discard them, then there's nothing for the kernel to write. This has been an invalid request as long as FreeBSD has supported msync flags: revision 1.20 date: 1995/03/25 17:36:00; author: davidg; state: Exp; lines: +6 -3 Disallow both MS_ASYNC and MS_INVALIDATE flags being set at the same time in msync(). ---------------------------- revision 1.19 date: 1995/03/25 16:55:46; author: davidg; state: Exp; lines: +11 -14 Added "flags" argument to msync, and implemented MS_ASYNC and MS_INVALIDATE. The MS_ASYNC flag doesn't current work, and MS_INVALIDATE will only toss out the pages in the address space (not all pages in the shadow chain). I don't know if MS_ASYNC currently works; alc would be the person to ask about it, since it looks like he worked on msync and vm_map_sync in November. -- Dan Nelson dnelson@allantgroup.com