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


1546          * Insert page on new list.
1547          */
1548         if (*ppp == NULL) {
1549                 *ppp = pp;
1550                 pp->p_next = pp->p_prev = pp;
1551         } else {
1552                 pp->p_next = *ppp;
1553                 pp->p_prev = (*ppp)->p_prev;
1554                 (*ppp)->p_prev = pp;
1555                 pp->p_prev->p_next = pp;
1556         }
1557 
1558         /*
1559          * Increment page counters
1560          */
1561         page_ctr_add_internal(mnode, mtype, pp, flags);
1562 
1563         /*
1564          * Update cage freemem counter
1565          */
1566         atomic_add_long(&kcage_freemem, 1);
1567 }
1568 #else   /* __sparc */
1569 
1570 /* ARGSUSED */
1571 void
1572 page_list_noreloc_startup(page_t *pp)
1573 {
1574         panic("page_list_noreloc_startup: should be here only for sparc");
1575 }
1576 #endif
1577 
1578 void
1579 page_list_add_pages(page_t *pp, int flags)
1580 {
1581         kmutex_t *pcm;
1582         pgcnt_t pgcnt;
1583         uint_t  bin, mtype, i;
1584         int     mnode;
1585 
1586         /* default to freelist/head */


4100 
4101         VM_STAT_ADD(vmm_vmstats.pgmc_allocfailed);
4102         return (NULL);
4103 }
4104 
4105 #ifdef DEBUG
4106 #define REPL_PAGE_STATS
4107 #endif /* DEBUG */
4108 
4109 #ifdef REPL_PAGE_STATS
4110 struct repl_page_stats {
4111         uint_t  ngets;
4112         uint_t  ngets_noreloc;
4113         uint_t  npgr_noreloc;
4114         uint_t  nnopage_first;
4115         uint_t  nnopage;
4116         uint_t  nhashout;
4117         uint_t  nnofree;
4118         uint_t  nnext_pp;
4119 } repl_page_stats;
4120 #define REPL_STAT_INCR(v)       atomic_add_32(&repl_page_stats.v, 1)
4121 #else /* REPL_PAGE_STATS */
4122 #define REPL_STAT_INCR(v)
4123 #endif /* REPL_PAGE_STATS */
4124 
4125 int     pgrppgcp;
4126 
4127 /*
4128  * The freemem accounting must be done by the caller.
4129  * First we try to get a replacement page of the same size as like_pp,
4130  * if that is not possible, then we just get a set of discontiguous
4131  * PAGESIZE pages.
4132  */
4133 page_t *
4134 page_get_replacement_page(page_t *orig_like_pp, struct lgrp *lgrp_target,
4135     uint_t pgrflags)
4136 {
4137         page_t          *like_pp;
4138         page_t          *pp, *pplist;
4139         page_t          *pl = NULL;
4140         ulong_t         bin;




1546          * Insert page on new list.
1547          */
1548         if (*ppp == NULL) {
1549                 *ppp = pp;
1550                 pp->p_next = pp->p_prev = pp;
1551         } else {
1552                 pp->p_next = *ppp;
1553                 pp->p_prev = (*ppp)->p_prev;
1554                 (*ppp)->p_prev = pp;
1555                 pp->p_prev->p_next = pp;
1556         }
1557 
1558         /*
1559          * Increment page counters
1560          */
1561         page_ctr_add_internal(mnode, mtype, pp, flags);
1562 
1563         /*
1564          * Update cage freemem counter
1565          */
1566         atomic_inc_ulong(&kcage_freemem);
1567 }
1568 #else   /* __sparc */
1569 
1570 /* ARGSUSED */
1571 void
1572 page_list_noreloc_startup(page_t *pp)
1573 {
1574         panic("page_list_noreloc_startup: should be here only for sparc");
1575 }
1576 #endif
1577 
1578 void
1579 page_list_add_pages(page_t *pp, int flags)
1580 {
1581         kmutex_t *pcm;
1582         pgcnt_t pgcnt;
1583         uint_t  bin, mtype, i;
1584         int     mnode;
1585 
1586         /* default to freelist/head */


4100 
4101         VM_STAT_ADD(vmm_vmstats.pgmc_allocfailed);
4102         return (NULL);
4103 }
4104 
4105 #ifdef DEBUG
4106 #define REPL_PAGE_STATS
4107 #endif /* DEBUG */
4108 
4109 #ifdef REPL_PAGE_STATS
4110 struct repl_page_stats {
4111         uint_t  ngets;
4112         uint_t  ngets_noreloc;
4113         uint_t  npgr_noreloc;
4114         uint_t  nnopage_first;
4115         uint_t  nnopage;
4116         uint_t  nhashout;
4117         uint_t  nnofree;
4118         uint_t  nnext_pp;
4119 } repl_page_stats;
4120 #define REPL_STAT_INCR(v)       atomic_inc_32(&repl_page_stats.v)
4121 #else /* REPL_PAGE_STATS */
4122 #define REPL_STAT_INCR(v)
4123 #endif /* REPL_PAGE_STATS */
4124 
4125 int     pgrppgcp;
4126 
4127 /*
4128  * The freemem accounting must be done by the caller.
4129  * First we try to get a replacement page of the same size as like_pp,
4130  * if that is not possible, then we just get a set of discontiguous
4131  * PAGESIZE pages.
4132  */
4133 page_t *
4134 page_get_replacement_page(page_t *orig_like_pp, struct lgrp *lgrp_target,
4135     uint_t pgrflags)
4136 {
4137         page_t          *like_pp;
4138         page_t          *pp, *pplist;
4139         page_t          *pl = NULL;
4140         ulong_t         bin;