From owner-svn-src-all@FreeBSD.ORG Sun May 12 21:49:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7427BD34; Sun, 12 May 2013 21:49:14 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) by mx1.freebsd.org (Postfix) with ESMTP id 4468C14E; Sun, 12 May 2013 21:49:13 +0000 (UTC) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.14.5/8.14.5) with SMTP id r4CLHtTE017720; Sun, 12 May 2013 16:49:13 -0500 Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by pp1.rice.edu with ESMTP id 1c3847mpqa-1; Sun, 12 May 2013 16:49:12 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 547A74C01BC; Sun, 12 May 2013 16:49:12 -0500 (CDT) Message-ID: <51900E57.80608@rice.edu> Date: Sun, 12 May 2013 16:49:11 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andrey Chernov Subject: Re: svn commit: r250577 - head/sys/vm References: <201305121650.r4CGoJL0087149@svn.freebsd.org> <51900B97.20406@freebsd.org> In-Reply-To: <51900B97.20406@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Alan Cox , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2013 21:49:14 -0000 On 05/12/2013 16:37, Andrey Chernov wrote: > On 12.05.2013 20:50, Alan Cox wrote: > > GNU cc errors related to part of diff below: > cc1: warnings being treated as errors > ../../../vm/vm_page.c: In function 'vm_page_alloc': > ../../../vm/vm_page.c:1209: warning: 'mpred' may be used uninitialized > in this function > *** [vm_page.o] Error code 1 > Formally yes, mpred here can be left unitialized. No, it can't. The code amounts to if ("x") mpred = ... ; ... if ("x") use mpred; ... if ("x") use mpred; where "x" is "object != NULL". Moreover, there are no assignments to the variable "object" or aliases by which the variable "object" can be modified over the lifespan of "mpred". So, this is flawed analysis by our antique gcc. >> @@ -1179,7 +1206,7 @@ vm_page_alloc(vm_object_t object, vm_pin >> { >> struct vnode *vp = NULL; >> vm_object_t m_object; >> - vm_page_t m; >> + vm_page_t m, mpred; >> int flags, req_class; >> >> KASSERT((object != NULL) == ((req & VM_ALLOC_NOOBJ) == 0), >> @@ -1195,6 +1222,11 @@ vm_page_alloc(vm_object_t object, vm_pin >> if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) >> req_class = VM_ALLOC_SYSTEM; >> >> + if (object != NULL) { >> + mpred = vm_radix_lookup_le(&object->rtree, pindex); >> + KASSERT(mpred == NULL || mpred->pindex != pindex, >> + ("vm_page_alloc: pindex already allocated")); >> + } >> mtx_lock(&vm_page_queue_free_mtx); >> if (cnt.v_free_count + cnt.v_cache_count > cnt.v_free_reserved || >> (req_class == VM_ALLOC_SYSTEM && >> @@ -1225,8 +1257,8 @@ vm_page_alloc(vm_object_t object, vm_pin >> return (NULL); >> #if VM_NRESERVLEVEL > 0 >> } else if (object == NULL || (object->flags & (OBJ_COLORED | >> - OBJ_FICTITIOUS)) != OBJ_COLORED || >> - (m = vm_reserv_alloc_page(object, pindex)) == NULL) { >> + OBJ_FICTITIOUS)) != OBJ_COLORED || (m = >> + vm_reserv_alloc_page(object, pindex, mpred)) == NULL) { >> #else >> } else { >> #endif >> @@ -1320,7 +1352,7 @@ vm_page_alloc(vm_object_t object, vm_pin >> if (object->memattr != VM_MEMATTR_DEFAULT && >> (object->flags & OBJ_FICTITIOUS) == 0) >> pmap_page_set_memattr(m, object->memattr); >> - vm_page_insert(m, object, pindex); >> + vm_page_insert_after(m, object, pindex, mpred); >> } else >> m->pindex = pindex;