Date: Fri, 10 May 2002 21:57:46 -0500 From: Alan Cox <alc@cs.rice.edu> To: John Baldwin <jhb@FreeBSD.org> Cc: alc@FreeBSD.org, Jeff Roberson <jroberson@chesapeake.net>, alpha@FreeBSD.ORG, obrien@FreeBSD.ORG, Andrew Gallatin <gallatin@cs.duke.edu> Subject: Re: gcc3 & alpha kernels Message-ID: <20020511025746.GD13871@cs.rice.edu> In-Reply-To: <XFMail.20020510211534.jhb@FreeBSD.org> References: <XFMail.20020510204837.jhb@FreeBSD.org> <XFMail.20020510211534.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020511025746.GD13871>
