From owner-freebsd-current Sun Aug 16 06:16:25 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA09978 for freebsd-current-outgoing; Sun, 16 Aug 1998 06:16:25 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from implode.root.com (implode.root.com [198.145.90.17]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA09969 for ; Sun, 16 Aug 1998 06:16:22 -0700 (PDT) (envelope-from root@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.5/8.8.5) with ESMTP id GAA00184; Sun, 16 Aug 1998 06:15:30 -0700 (PDT) Message-Id: <199808161315.GAA00184@implode.root.com> To: Terry Lambert cc: current@FreeBSD.ORG, karl@mcs.net Subject: Re: Better VM patches (was Tentative fix for VM bug) In-reply-to: Your message of "Sun, 16 Aug 1998 01:13:33 -0000." <199808160113.SAA17303@usr07.primenet.com> From: David Greenman Reply-To: dg@root.com Date: Sun, 16 Aug 1998 06:15:30 -0700 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >The problem with vm_object_page_remove() is that in the clean_only != 0 >case, the page is marked invalid. > >This will result in orphaned pages. I don't think "orphaned" pages will be created, but I can imagine that changes might be lost in the wired && clean_only case. I agree that this appears to be a bug. It might be a bug in the wired && !clean_only case, too - in other words, setting valid=0 might never be correct for wired pages. >This may be the source of the: > > * XXX: sometimes we get pages which aren't wired down or on any queue - > * we need to put them on the inactive queue also, otherwise we lose > * track of them. Paul Mackerras (paulus@cs.anu.edu.au) 9-Jan-93. > >comment in vm_page.c, and it may be the source of the zero page >phenomenon. That comment simply means what it says and must be taken in the context of the function where it appears (vm_page_deactivate). The system sometimes needs to put a page on a queue - any queue, and vm_page_deactivate needs to be able to handle the case of not-on-any-queue. Really, the comment is obsolete and dates back to a time when the VM system didn't manage the page queues properly. >Another problem in the mmap code is that when the vnode_pager object >is created, it is set to be the number of pages times the page size >in length; but also in vnode_pager, the setsize on the object sets >the length to the actual file length. > >This discrepancy opens a window in which some changes may be lost. My reading of the code shows that the object size is set to the rounded-up index. vnp_size is set to the unrounded new size, but that's expected and I don't see any bugs related to doing that; rounding it will likely break the proper reading of partial pages. Am I missing something? vnp_size is mostly private to the vnode_pager. The rounded-up object->size is used outside of the vnode pager. >John also suggested another change for detecting a case where page >orphans can be created. in vm_page.c, it's possible that an object >entry in the page insert function will overwrite an existing entry; >I added a DIAGNOSTIC panic to catch this when it happens. You mean that there can be multiple pages at the same offset? It would be bad if that happend, but I'm skeptical that it actually does. >*************** >*** 990,995 **** >--- 990,1002 ---- > handle, OFF_TO_IDX(objsize), prot, foff); > if (object == NULL) > return (type == OBJT_DEVICE ? EINVAL : ENOMEM); >+ /* >+ * XXX we are in a race here. If the file is extended >+ * between the time we get the object and the time >+ * we set the size, then we lose... >+ */ >+ if (!(flags & MAP_ANON) && vp->v_type != VCHR) >+ object->un_pager.vnp.vnp_size = vat.va_size; Hmmm. >+ /* >+ * The object is allocated to a page boundary. This is >+ * incorrect if page is only partially backed by the vp; >+ * we must fix this up in the caller. >+ */ > object->un_pager.vnp.vnp_size = (vm_ooffset_t) size * PAGE_SIZE; I think the above change is wrong. -DG David Greenman Co-founder/Principal Architect, The FreeBSD Project To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message