Print this page
seg_inherit_notsup is redundant since segop_inherit checks for NULL properly


  63  * sptcreate when ISM is created.  ISM should not use more
  64  * than ~90% of availrmem; if it does, then the performance
  65  * of the system may decrease. Machines with large memories may
  66  * be able to use up more memory for ISM so we set the default
  67  * segspt_minfree to 5% (which gives ISM max 95% of availrmem.
  68  * If somebody wants even more memory for ISM (risking hanging
  69  * the system) they can patch the segspt_minfree to smaller number.
  70  */
  71 pgcnt_t segspt_minfree = 0;
  72 
  73 static int segspt_create(struct seg *seg, caddr_t argsp);
  74 static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
  75 static void segspt_free(struct seg *seg);
  76 static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
  77 static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
  78 
  79 struct seg_ops segspt_ops = {
  80         .unmap          = segspt_unmap,
  81         .free           = segspt_free,
  82         .getpolicy      = segspt_getpolicy,
  83         .inherit        = seg_inherit_notsup,
  84 };
  85 
  86 static int segspt_shmdup(struct seg *seg, struct seg *newseg);
  87 static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
  88 static void segspt_shmfree(struct seg *seg);
  89 static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
  90                 caddr_t addr, size_t len, enum fault_type type, enum seg_rw rw);
  91 static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
  92 static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
  93                         register size_t len, register uint_t prot);
  94 static int segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size,
  95                         uint_t prot);
  96 static int      segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta);
  97 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
  98                         register char *vec);
  99 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
 100                         int attr, uint_t flags);
 101 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
 102                         int attr, int op, ulong_t *lockmap, size_t pos);
 103 static int segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len,


 121         .free           = segspt_shmfree,
 122         .fault          = segspt_shmfault,
 123         .faulta         = segspt_shmfaulta,
 124         .setprot        = segspt_shmsetprot,
 125         .checkprot      = segspt_shmcheckprot,
 126         .kluster        = segspt_shmkluster,
 127         .sync           = segspt_shmsync,
 128         .incore         = segspt_shmincore,
 129         .lockop         = segspt_shmlockop,
 130         .getprot        = segspt_shmgetprot,
 131         .getoffset      = segspt_shmgetoffset,
 132         .gettype        = segspt_shmgettype,
 133         .getvp          = segspt_shmgetvp,
 134         .advise         = segspt_shmadvise,
 135         .dump           = segspt_shmdump,
 136         .pagelock       = segspt_shmpagelock,
 137         .setpagesize    = segspt_shmsetpgsz,
 138         .getmemid       = segspt_shmgetmemid,
 139         .getpolicy      = segspt_shmgetpolicy,
 140         .capable        = segspt_shmcapable,
 141         .inherit        = seg_inherit_notsup,
 142 };
 143 
 144 static void segspt_purge(struct seg *seg);
 145 static int segspt_reclaim(void *, caddr_t, size_t, struct page **,
 146                 enum seg_rw, int);
 147 static int spt_anon_getpages(struct seg *seg, caddr_t addr, size_t len,
 148                 page_t **ppa);
 149 
 150 
 151 
 152 /*ARGSUSED*/
 153 int
 154 sptcreate(size_t size, struct seg **sptseg, struct anon_map *amp,
 155         uint_t prot, uint_t flags, uint_t share_szc)
 156 {
 157         int     err;
 158         struct  as      *newas;
 159         struct  segspt_crargs sptcargs;
 160 
 161 #ifdef DEBUG




  63  * sptcreate when ISM is created.  ISM should not use more
  64  * than ~90% of availrmem; if it does, then the performance
  65  * of the system may decrease. Machines with large memories may
  66  * be able to use up more memory for ISM so we set the default
  67  * segspt_minfree to 5% (which gives ISM max 95% of availrmem.
  68  * If somebody wants even more memory for ISM (risking hanging
  69  * the system) they can patch the segspt_minfree to smaller number.
  70  */
  71 pgcnt_t segspt_minfree = 0;
  72 
  73 static int segspt_create(struct seg *seg, caddr_t argsp);
  74 static int segspt_unmap(struct seg *seg, caddr_t raddr, size_t ssize);
  75 static void segspt_free(struct seg *seg);
  76 static void segspt_free_pages(struct seg *seg, caddr_t addr, size_t len);
  77 static lgrp_mem_policy_info_t *segspt_getpolicy(struct seg *seg, caddr_t addr);
  78 
  79 struct seg_ops segspt_ops = {
  80         .unmap          = segspt_unmap,
  81         .free           = segspt_free,
  82         .getpolicy      = segspt_getpolicy,

  83 };
  84 
  85 static int segspt_shmdup(struct seg *seg, struct seg *newseg);
  86 static int segspt_shmunmap(struct seg *seg, caddr_t raddr, size_t ssize);
  87 static void segspt_shmfree(struct seg *seg);
  88 static faultcode_t segspt_shmfault(struct hat *hat, struct seg *seg,
  89                 caddr_t addr, size_t len, enum fault_type type, enum seg_rw rw);
  90 static faultcode_t segspt_shmfaulta(struct seg *seg, caddr_t addr);
  91 static int segspt_shmsetprot(register struct seg *seg, register caddr_t addr,
  92                         register size_t len, register uint_t prot);
  93 static int segspt_shmcheckprot(struct seg *seg, caddr_t addr, size_t size,
  94                         uint_t prot);
  95 static int      segspt_shmkluster(struct seg *seg, caddr_t addr, ssize_t delta);
  96 static size_t segspt_shmincore(struct seg *seg, caddr_t addr, size_t len,
  97                         register char *vec);
  98 static int segspt_shmsync(struct seg *seg, register caddr_t addr, size_t len,
  99                         int attr, uint_t flags);
 100 static int segspt_shmlockop(struct seg *seg, caddr_t addr, size_t len,
 101                         int attr, int op, ulong_t *lockmap, size_t pos);
 102 static int segspt_shmgetprot(struct seg *seg, caddr_t addr, size_t len,


 120         .free           = segspt_shmfree,
 121         .fault          = segspt_shmfault,
 122         .faulta         = segspt_shmfaulta,
 123         .setprot        = segspt_shmsetprot,
 124         .checkprot      = segspt_shmcheckprot,
 125         .kluster        = segspt_shmkluster,
 126         .sync           = segspt_shmsync,
 127         .incore         = segspt_shmincore,
 128         .lockop         = segspt_shmlockop,
 129         .getprot        = segspt_shmgetprot,
 130         .getoffset      = segspt_shmgetoffset,
 131         .gettype        = segspt_shmgettype,
 132         .getvp          = segspt_shmgetvp,
 133         .advise         = segspt_shmadvise,
 134         .dump           = segspt_shmdump,
 135         .pagelock       = segspt_shmpagelock,
 136         .setpagesize    = segspt_shmsetpgsz,
 137         .getmemid       = segspt_shmgetmemid,
 138         .getpolicy      = segspt_shmgetpolicy,
 139         .capable        = segspt_shmcapable,

 140 };
 141 
 142 static void segspt_purge(struct seg *seg);
 143 static int segspt_reclaim(void *, caddr_t, size_t, struct page **,
 144                 enum seg_rw, int);
 145 static int spt_anon_getpages(struct seg *seg, caddr_t addr, size_t len,
 146                 page_t **ppa);
 147 
 148 
 149 
 150 /*ARGSUSED*/
 151 int
 152 sptcreate(size_t size, struct seg **sptseg, struct anon_map *amp,
 153         uint_t prot, uint_t flags, uint_t share_szc)
 154 {
 155         int     err;
 156         struct  as      *newas;
 157         struct  segspt_crargs sptcargs;
 158 
 159 #ifdef DEBUG