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


1210  */
1211 size_t
1212 hat_get_mapped_size(hat_t *hat)
1213 {
1214         size_t total = 0;
1215         int l;
1216 
1217         for (l = 0; l <= mmu.max_page_level; l++)
1218                 total += (hat->hat_pages_mapped[l] << LEVEL_SHIFT(l));
1219         total += hat->hat_ism_pgcnt;
1220 
1221         return (total);
1222 }
1223 
1224 /*
1225  * enable/disable collection of stats for hat.
1226  */
1227 int
1228 hat_stats_enable(hat_t *hat)
1229 {
1230         atomic_add_32(&hat->hat_stats, 1);
1231         return (1);
1232 }
1233 
1234 void
1235 hat_stats_disable(hat_t *hat)
1236 {
1237         atomic_add_32(&hat->hat_stats, -1);
1238 }
1239 
1240 /*
1241  * Utility to sync the ref/mod bits from a page table entry to the page_t
1242  * We must be holding the mapping list lock when this is called.
1243  */
1244 static void
1245 hati_sync_pte_to_page(page_t *pp, x86pte_t pte, level_t level)
1246 {
1247         uint_t  rm = 0;
1248         pgcnt_t pgcnt;
1249 
1250         if (PTE_GET(pte, PT_SOFTWARE) >= PT_NOSYNC)
1251                 return;
1252 
1253         if (PTE_GET(pte, PT_REF))
1254                 rm |= P_REF;
1255 
1256         if (PTE_GET(pte, PT_MOD))
1257                 rm |= P_MOD;




1210  */
1211 size_t
1212 hat_get_mapped_size(hat_t *hat)
1213 {
1214         size_t total = 0;
1215         int l;
1216 
1217         for (l = 0; l <= mmu.max_page_level; l++)
1218                 total += (hat->hat_pages_mapped[l] << LEVEL_SHIFT(l));
1219         total += hat->hat_ism_pgcnt;
1220 
1221         return (total);
1222 }
1223 
1224 /*
1225  * enable/disable collection of stats for hat.
1226  */
1227 int
1228 hat_stats_enable(hat_t *hat)
1229 {
1230         atomic_inc_32(&hat->hat_stats);
1231         return (1);
1232 }
1233 
1234 void
1235 hat_stats_disable(hat_t *hat)
1236 {
1237         atomic_dec_32(&hat->hat_stats);
1238 }
1239 
1240 /*
1241  * Utility to sync the ref/mod bits from a page table entry to the page_t
1242  * We must be holding the mapping list lock when this is called.
1243  */
1244 static void
1245 hati_sync_pte_to_page(page_t *pp, x86pte_t pte, level_t level)
1246 {
1247         uint_t  rm = 0;
1248         pgcnt_t pgcnt;
1249 
1250         if (PTE_GET(pte, PT_SOFTWARE) >= PT_NOSYNC)
1251                 return;
1252 
1253         if (PTE_GET(pte, PT_REF))
1254                 rm |= P_REF;
1255 
1256         if (PTE_GET(pte, PT_MOD))
1257                 rm |= P_MOD;