Print this page
5042 stop using deprecated atomic functions
*** 84,94 ****
}
mnode = PFN_2_MEM_NODE(start);
ASSERT(mnode >= 0 && mnode < max_mem_nodes);
! if (cas32((uint32_t *)&mem_node_config[mnode].exists, 0, 1)) {
/*
* Add slice to existing node.
*/
if (start < mem_node_config[mnode].physbase)
mem_node_config[mnode].physbase = start;
--- 84,94 ----
}
mnode = PFN_2_MEM_NODE(start);
ASSERT(mnode >= 0 && mnode < max_mem_nodes);
! if (atomic_cas_32((uint32_t *)&mem_node_config[mnode].exists, 0, 1)) {
/*
* Add slice to existing node.
*/
if (start < mem_node_config[mnode].physbase)
mem_node_config[mnode].physbase = start;
*** 99,109 ****
mem_node_config[mnode].physmax = end;
atomic_add_16(&num_memnodes, 1);
do {
oldmask = memnodes_mask;
newmask = memnodes_mask | (1ull << mnode);
! } while (cas64(&memnodes_mask, oldmask, newmask) != oldmask);
}
/*
* Inform the common lgrp framework about the new memory
*/
--- 99,110 ----
mem_node_config[mnode].physmax = end;
atomic_add_16(&num_memnodes, 1);
do {
oldmask = memnodes_mask;
newmask = memnodes_mask | (1ull << mnode);
! } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) !=
! oldmask);
}
/*
* Inform the common lgrp framework about the new memory
*/
*** 159,169 ****
*/
ASSERT(MNODE_PGCNT(mnode) == 0);
do {
omask = memnodes_mask;
nmask = omask & ~(1ull << mnode);
! } while (cas64(&memnodes_mask, omask, nmask) != omask);
atomic_add_16(&num_memnodes, -1);
mem_node_config[mnode].exists = 0;
}
}
--- 160,170 ----
*/
ASSERT(MNODE_PGCNT(mnode) == 0);
do {
omask = memnodes_mask;
nmask = omask & ~(1ull << mnode);
! } while (atomic_cas_64(&memnodes_mask, omask, nmask) != omask);
atomic_add_16(&num_memnodes, -1);
mem_node_config[mnode].exists = 0;
}
}
*** 227,237 ****
/*
* Find an unused memnode. Update it atomically to prevent
* a first time memnode creation race.
*/
for (mnode = 0; mnode < max_mem_nodes; mnode++)
! if (cas32((uint32_t *)&mem_node_config[mnode].exists,
0, 1) == 0)
break;
if (mnode >= max_mem_nodes)
panic("Out of free memnodes\n");
--- 228,238 ----
/*
* Find an unused memnode. Update it atomically to prevent
* a first time memnode creation race.
*/
for (mnode = 0; mnode < max_mem_nodes; mnode++)
! if (atomic_cas_32((uint32_t *)&mem_node_config[mnode].exists,
0, 1) == 0)
break;
if (mnode >= max_mem_nodes)
panic("Out of free memnodes\n");
*** 240,250 ****
mem_node_config[mnode].physmax = 0;
atomic_add_16(&num_memnodes, 1);
do {
oldmask = memnodes_mask;
newmask = memnodes_mask | (1ull << mnode);
! } while (cas64(&memnodes_mask, oldmask, newmask) != oldmask);
return (mnode);
}
/*
--- 241,251 ----
mem_node_config[mnode].physmax = 0;
atomic_add_16(&num_memnodes, 1);
do {
oldmask = memnodes_mask;
newmask = memnodes_mask | (1ull << mnode);
! } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) != oldmask);
return (mnode);
}
/*