diff options
author | Alan Cox <alc@FreeBSD.org> | 2004-11-06 21:48:45 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2004-11-06 21:48:45 +0000 |
commit | dad740e96713474752fcf188d34806d0e726d43b (patch) | |
tree | e4d1db94da55b65b47949cd4f032c5b6fd104894 /sys | |
parent | 2a44183a720ce6ca7e40f5616817d48d208a729c (diff) | |
download | src-dad740e96713474752fcf188d34806d0e726d43b.tar.gz src-dad740e96713474752fcf188d34806d0e726d43b.zip |
Eliminate an unnecessary atomic operation. Articulate the rationale in
a comment.
Notes
Notes:
svn path=/head/; revision=137324
Diffstat (limited to 'sys')
-rw-r--r-- | sys/vm/vm_object.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 4df862b0cb56..9704be0b7a7a 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -145,7 +145,16 @@ struct vm_object kmem_object_store; static long object_collapses; static long object_bypasses; + +/* + * next_index determines the page color that is assigned to the next + * allocated object. Accesses to next_index are not synchronized + * because the effects of two or more object allocations using + * next_index simultaneously are inconsequential. At any given time, + * numerous objects have the same page color. + */ static int next_index; + static uma_zone_t obj_zone; #define VM_OBJECTS_INIT 256 @@ -211,10 +220,8 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, vm_object_t object) incr = PQ_L2_SIZE / 3 + PQ_PRIME1; else incr = size; - do - object->pg_color = next_index; - while (!atomic_cmpset_int(&next_index, object->pg_color, - (object->pg_color + incr) & PQ_L2_MASK)); + object->pg_color = next_index; + next_index = (object->pg_color + incr) & PQ_L2_MASK; object->handle = NULL; object->backing_object = NULL; object->backing_object_offset = (vm_ooffset_t) 0; |