Print this page
patch as-lock-macro-simplification


5364 void
5365 page_mark_migrate(struct seg *seg, caddr_t addr, size_t len,
5366     struct anon_map *amp, ulong_t anon_index, vnode_t *vp,
5367     u_offset_t vnoff, int rflag)
5368 {
5369         struct anon     *ap;
5370         vnode_t         *curvp;
5371         lgrp_t          *from;
5372         pgcnt_t         nlocked;
5373         u_offset_t      off;
5374         pfn_t           pfn;
5375         size_t          pgsz;
5376         size_t          segpgsz;
5377         pgcnt_t         pages;
5378         uint_t          pszc;
5379         page_t          *pp0, *pp;
5380         caddr_t         va;
5381         ulong_t         an_idx;
5382         anon_sync_obj_t cookie;
5383 
5384         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as, &seg->s_as->a_lock));
5385 
5386         /*
5387          * Don't do anything if don't need to do lgroup optimizations
5388          * on this system
5389          */
5390         if (!lgrp_optimizations())
5391                 return;
5392 
5393         /*
5394          * Align address and length to (potentially large) page boundary
5395          */
5396         segpgsz = page_get_pagesize(seg->s_szc);
5397         addr = (caddr_t)P2ALIGN((uintptr_t)addr, segpgsz);
5398         if (rflag)
5399                 len = P2ROUNDUP(len, segpgsz);
5400 
5401         /*
5402          * Do one (large) page at a time
5403          */
5404         va = addr;


5542 /*
5543  * Migrate any pages that have been marked for migration in the given range
5544  */
5545 void
5546 page_migrate(
5547         struct seg      *seg,
5548         caddr_t         addr,
5549         page_t          **ppa,
5550         pgcnt_t         npages)
5551 {
5552         lgrp_t          *from;
5553         lgrp_t          *to;
5554         page_t          *newpp;
5555         page_t          *pp;
5556         pfn_t           pfn;
5557         size_t          pgsz;
5558         spgcnt_t        page_cnt;
5559         spgcnt_t        i;
5560         uint_t          pszc;
5561 
5562         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as, &seg->s_as->a_lock));
5563 
5564         while (npages > 0) {
5565                 pp = *ppa;
5566                 pszc = pp->p_szc;
5567                 pgsz = page_get_pagesize(pszc);
5568                 page_cnt = btop(pgsz);
5569 
5570                 /*
5571                  * Check to see whether this page is marked for migration
5572                  *
5573                  * Assume that root page of large page is marked for
5574                  * migration and none of the other constituent pages
5575                  * are marked.  This really simplifies clearing the
5576                  * migrate bit by not having to clear it from each
5577                  * constituent page.
5578                  *
5579                  * note we don't want to relocate an entire large page if
5580                  * someone is only using one subpage.
5581                  */
5582                 if (npages < page_cnt)




5364 void
5365 page_mark_migrate(struct seg *seg, caddr_t addr, size_t len,
5366     struct anon_map *amp, ulong_t anon_index, vnode_t *vp,
5367     u_offset_t vnoff, int rflag)
5368 {
5369         struct anon     *ap;
5370         vnode_t         *curvp;
5371         lgrp_t          *from;
5372         pgcnt_t         nlocked;
5373         u_offset_t      off;
5374         pfn_t           pfn;
5375         size_t          pgsz;
5376         size_t          segpgsz;
5377         pgcnt_t         pages;
5378         uint_t          pszc;
5379         page_t          *pp0, *pp;
5380         caddr_t         va;
5381         ulong_t         an_idx;
5382         anon_sync_obj_t cookie;
5383 
5384         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as));
5385 
5386         /*
5387          * Don't do anything if don't need to do lgroup optimizations
5388          * on this system
5389          */
5390         if (!lgrp_optimizations())
5391                 return;
5392 
5393         /*
5394          * Align address and length to (potentially large) page boundary
5395          */
5396         segpgsz = page_get_pagesize(seg->s_szc);
5397         addr = (caddr_t)P2ALIGN((uintptr_t)addr, segpgsz);
5398         if (rflag)
5399                 len = P2ROUNDUP(len, segpgsz);
5400 
5401         /*
5402          * Do one (large) page at a time
5403          */
5404         va = addr;


5542 /*
5543  * Migrate any pages that have been marked for migration in the given range
5544  */
5545 void
5546 page_migrate(
5547         struct seg      *seg,
5548         caddr_t         addr,
5549         page_t          **ppa,
5550         pgcnt_t         npages)
5551 {
5552         lgrp_t          *from;
5553         lgrp_t          *to;
5554         page_t          *newpp;
5555         page_t          *pp;
5556         pfn_t           pfn;
5557         size_t          pgsz;
5558         spgcnt_t        page_cnt;
5559         spgcnt_t        i;
5560         uint_t          pszc;
5561 
5562         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as));
5563 
5564         while (npages > 0) {
5565                 pp = *ppa;
5566                 pszc = pp->p_szc;
5567                 pgsz = page_get_pagesize(pszc);
5568                 page_cnt = btop(pgsz);
5569 
5570                 /*
5571                  * Check to see whether this page is marked for migration
5572                  *
5573                  * Assume that root page of large page is marked for
5574                  * migration and none of the other constituent pages
5575                  * are marked.  This really simplifies clearing the
5576                  * migrate bit by not having to clear it from each
5577                  * constituent page.
5578                  *
5579                  * note we don't want to relocate an entire large page if
5580                  * someone is only using one subpage.
5581                  */
5582                 if (npages < page_cnt)