Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 92,102 **** if (end > mem_node_config[mnode].physmax) mem_node_config[mnode].physmax = end; } else { mem_node_config[mnode].physbase = start; 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); --- 92,102 ---- if (end > mem_node_config[mnode].physmax) mem_node_config[mnode].physmax = end; } else { mem_node_config[mnode].physbase = start; mem_node_config[mnode].physmax = end; ! atomic_inc_16(&num_memnodes); do { oldmask = memnodes_mask; newmask = memnodes_mask | (1ull << mnode); } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) != oldmask);
*** 158,168 **** 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; } } void --- 158,168 ---- ASSERT(MNODE_PGCNT(mnode) == 0); do { omask = memnodes_mask; nmask = omask & ~(1ull << mnode); } while (atomic_cas_64(&memnodes_mask, omask, nmask) != omask); ! atomic_dec_16(&num_memnodes); mem_node_config[mnode].exists = 0; } } void
*** 228,238 **** if (mnode >= max_mem_nodes) panic("Out of free memnodes\n"); mem_node_config[mnode].physbase = (uint64_t)-1; 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); --- 228,238 ---- if (mnode >= max_mem_nodes) panic("Out of free memnodes\n"); mem_node_config[mnode].physbase = (uint64_t)-1; mem_node_config[mnode].physmax = 0; ! atomic_inc_16(&num_memnodes); do { oldmask = memnodes_mask; newmask = memnodes_mask | (1ull << mnode); } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) != oldmask);