From owner-freebsd-current@FreeBSD.ORG Thu Mar 4 19:28:57 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B857116A4CE for ; Thu, 4 Mar 2004 19:28:57 -0800 (PST) Received: from host117.ipowerweb.com (host117.ipowerweb.com [12.129.237.159]) by mx1.FreeBSD.org (Postfix) with SMTP id 8FDA943D2D for ; Thu, 4 Mar 2004 19:28:57 -0800 (PST) (envelope-from alc@imimic.com) Received: (qmail 1097 invoked from network); 5 Mar 2004 03:31:43 -0000 Received: from unknown (HELO imimic.com) (216.63.78.18) by host117.ipowerweb.com with SMTP; 5 Mar 2004 03:31:43 -0000 Message-ID: <4047F3F8.1080207@imimic.com> Date: Thu, 04 Mar 2004 21:28:56 -0600 From: "Alan L. Cox" Organization: iMimic Networking, Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6a) Gecko/20031207 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcel Moolenaar References: <20040304025223.GA622@dhcp01.pn.xcllnt.net> <20040304161108.U26303@root.org> <20040305025524.GA601@dhcp01.pn.xcllnt.net> In-Reply-To: <20040305025524.GA601@dhcp01.pn.xcllnt.net> Content-Type: multipart/mixed; boundary="------------050901050509040204060304" X-Mailman-Approved-At: Fri, 05 Mar 2004 04:55:08 -0800 cc: alc@freebsd.org cc: rwatson@freebsd.org cc: current@freebsd.org cc: Nate Lawson Subject: Re: bug in vm_contig.c? [was: Re: ACPI crash with recent changes] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2004 03:28:57 -0000 This is a multi-part message in MIME format. --------------050901050509040204060304 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Please test the attached patch instead. In order to avoid a race condition, it is necessary for the loop to begin with "start" rather than "start + 1". What is both unnecessary and wrong is the physical contiguity check. (My bad. :-() In other words, the test that the page is still free must be repeated because of the dropping of the free page queue lock, but contiguity once true is always true. Regards, Alan --------------050901050509040204060304 Content-Type: text/plain; name="vm_contig.c-bug-fix" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vm_contig.c-bug-fix" Index: vm/vm_contig.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_contig.c,v retrieving revision 1.31 diff -u -r1.31 vm_contig.c --- vm/vm_contig.c 2 Mar 2004 08:25:58 -0000 1.31 +++ vm/vm_contig.c 5 Mar 2004 03:08:17 -0000 @@ -232,9 +232,7 @@ mtx_lock_spin(&vm_page_queue_free_mtx); for (i = start; i < (start + size / PAGE_SIZE); i++) { pqtype = pga[i].queue - pga[i].pc; - if ((VM_PAGE_TO_PHYS(&pga[i]) != - (VM_PAGE_TO_PHYS(&pga[i - 1]) + PAGE_SIZE)) || - (pqtype != PQ_FREE)) { + if (pqtype != PQ_FREE) { start++; goto again; } --------------050901050509040204060304--