From owner-freebsd-alpha Fri May 10 19:57:54 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id 73A8337B403; Fri, 10 May 2002 19:57:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cs.rice.edu (Postfix) with ESMTP id 6B8704A9E2; Fri, 10 May 2002 21:57:47 -0500 (CDT) Received: by cs.rice.edu (Postfix, from userid 19572) id CB0E74A9A2; Fri, 10 May 2002 21:57:46 -0500 (CDT) Date: Fri, 10 May 2002 21:57:46 -0500 From: Alan Cox To: John Baldwin Cc: alc@FreeBSD.org, Jeff Roberson , alpha@FreeBSD.ORG, obrien@FreeBSD.ORG, Andrew Gallatin Subject: Re: gcc3 & alpha kernels Message-ID: <20020511025746.GD13871@cs.rice.edu> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wRRV7LY7NUeQGEoC" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Virus-Scanned: by AMaViS snapshot-20010714 Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 10, 2002 at 09:15:34PM -0400, John Baldwin wrote: > > On 11-May-2002 John Baldwin wrote: > > One fix would be to cast object->pg_color to an int for this call but that > > still has wrapping issues. A better fix is probably to stop microptimizing > > struct vm_object and use a int for pg_color. I suggest that all the atomic > > ops buried in the vm code be checked very carefully for these types of > > short/int mismatches as well as any int/long mismatches and the like. > > Making next_index and incr be u_short instead of int also might fix > this. However, then you would really need to use atomic_cmpset_short(), > and we really want to deprecate that since it isn't really feasible > on sparc64 and some other arch's. I would probably vote for just making > pg_color a u_int and changing next_index and incr to be u_int. > Agreed. I've changed hash_rand as well. Could someone please test the attached patch? Thanks, Alan --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vm_object.patch" Index: vm/vm_object.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_object.c,v retrieving revision 1.211 diff -c -r1.211 vm_object.c *** vm/vm_object.c 6 May 2002 05:45:57 -0000 1.211 --- vm/vm_object.c 11 May 2002 02:52:33 -0000 *************** *** 146,152 **** static long object_collapses; static long object_bypasses; ! static int next_index; static uma_zone_t obj_zone; #define VM_OBJECTS_INIT 256 --- 146,152 ---- static long object_collapses; static long object_bypasses; ! static u_int next_index; static uma_zone_t obj_zone; #define VM_OBJECTS_INIT 256 *************** *** 189,196 **** void _vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object) { ! static int object_hash_rand; ! int exp, incr; TAILQ_INIT(&object->memq); TAILQ_INIT(&object->shadow_head); --- 189,196 ---- void _vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object) { ! static u_int object_hash_rand; ! u_int exp, incr; TAILQ_INIT(&object->memq); TAILQ_INIT(&object->shadow_head); Index: vm/vm_object.h =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_object.h,v retrieving revision 1.78 diff -c -r1.78 vm_object.h *** vm/vm_object.h 6 May 2002 00:12:47 -0000 1.78 --- vm/vm_object.h 11 May 2002 02:52:33 -0000 *************** *** 96,105 **** vm_size_t size; /* Object size */ int ref_count; /* How many refs?? */ int shadow_count; /* how many objects that this is a shadow for */ ! int hash_rand; /* (c) hash table randomizer */ objtype_t type; /* type of pager */ u_short flags; /* see below */ - u_short pg_color; /* (c) color of first page in obj */ u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ --- 96,105 ---- vm_size_t size; /* Object size */ int ref_count; /* How many refs?? */ int shadow_count; /* how many objects that this is a shadow for */ ! u_int hash_rand; /* (c) hash table randomizer */ ! u_int pg_color; /* (c) color of first page in obj */ objtype_t type; /* type of pager */ u_short flags; /* see below */ u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ int resident_page_count; /* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ --wRRV7LY7NUeQGEoC-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message