Print this page
patch SEGOP_SWAPOUT-delete
patch remove-dont-swap-flag

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg_kp.c
          +++ new/usr/src/uts/common/vm/seg_kp.c
↓ open down ↓ 146 lines elided ↑ open up ↑
 147  147  
 148  148  static struct   seg_ops segkp_ops = {
 149  149          SEGKP_BADOP(int),               /* dup */
 150  150          SEGKP_BADOP(int),               /* unmap */
 151  151          SEGKP_BADOP(void),              /* free */
 152  152          segkp_fault,
 153  153          SEGKP_BADOP(faultcode_t),       /* faulta */
 154  154          SEGKP_BADOP(int),               /* setprot */
 155  155          segkp_checkprot,
 156  156          segkp_kluster,
 157      -        SEGKP_BADOP(size_t),            /* swapout */
 158  157          SEGKP_BADOP(int),               /* sync */
 159  158          SEGKP_BADOP(size_t),            /* incore */
 160  159          SEGKP_BADOP(int),               /* lockop */
 161  160          SEGKP_BADOP(int),               /* getprot */
 162  161          SEGKP_BADOP(u_offset_t),                /* getoffset */
 163  162          SEGKP_BADOP(int),               /* gettype */
 164  163          SEGKP_BADOP(int),               /* getvp */
 165  164          SEGKP_BADOP(int),               /* advise */
 166  165          segkp_dump,                     /* dump */
 167  166          segkp_pagelock,                 /* pagelock */
↓ open down ↓ 585 lines elided ↑ open up ↑
 753  752  
 754  753          vmem_free(SEGKP_VMEM(seg), kpd->kp_base, kpd->kp_len);
 755  754          kmem_free(kpd, sizeof (struct segkp_data));
 756  755  }
 757  756  
 758  757  /*
 759  758   * segkp_map_red() will check the current frame pointer against the
 760  759   * stack base.  If the amount of stack remaining is questionable
 761  760   * (less than red_minavail), then segkp_map_red() will map in the redzone
 762  761   * and return 1.  Otherwise, it will return 0.  segkp_map_red() can
 763      - * _only_ be called when:
 764      - *
 765      - *   - it is safe to sleep on page_create_va().
 766      - *   - the caller is non-swappable.
      762 + * _only_ be called when it is safe to sleep on page_create_va().
 767  763   *
 768  764   * It is up to the caller to remember whether segkp_map_red() successfully
 769  765   * mapped the redzone, and, if so, to call segkp_unmap_red() at a later
 770      - * time.  Note that the caller must _remain_ non-swappable until after
 771      - * calling segkp_unmap_red().
      766 + * time.
 772  767   *
 773  768   * Currently, this routine is only called from pagefault() (which necessarily
 774  769   * satisfies the above conditions).
 775  770   */
 776  771  #if defined(STACK_GROWTH_DOWN)
 777  772  int
 778  773  segkp_map_red(void)
 779  774  {
 780  775          uintptr_t fp = STACK_BIAS + (uintptr_t)getfp();
 781  776  #ifndef _LP64
 782  777          caddr_t stkbase;
 783  778  #endif
 784  779  
 785      -        ASSERT(curthread->t_schedflag & TS_DONT_SWAP);
 786      -
 787  780          /*
 788  781           * Optimize for the common case where we simply return.
 789  782           */
 790  783          if ((curthread->t_red_pp == NULL) &&
 791  784              (fp - (uintptr_t)curthread->t_stkbase >= red_minavail))
 792  785                  return (0);
 793  786  
 794  787  #if defined(_LP64)
 795  788          /*
 796  789           * XXX  We probably need something better than this.
↓ open down ↓ 80 lines elided ↑ open up ↑
 877  870  }
 878  871  
 879  872  void
 880  873  segkp_unmap_red(void)
 881  874  {
 882  875          page_t *pp;
 883  876          caddr_t red_va = (caddr_t)(((uintptr_t)curthread->t_stkbase &
 884  877              (uintptr_t)PAGEMASK) - PAGESIZE);
 885  878  
 886  879          ASSERT(curthread->t_red_pp != NULL);
 887      -        ASSERT(curthread->t_schedflag & TS_DONT_SWAP);
 888  880  
 889  881          /*
 890  882           * Because we locked the mapping down, we can't simply rely
 891  883           * on page_destroy() to clean everything up;  we need to call
 892  884           * hat_unload() to explicitly unlock the mapping resources.
 893  885           */
 894  886          hat_unload(kas.a_hat, red_va, PAGESIZE, HAT_UNLOAD_UNLOCK);
 895  887  
 896  888          pp = curthread->t_red_pp;
 897  889  
↓ open down ↓ 569 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX