Print this page
use NULL capable segop as a shorthand for no-capabilities
Instead of forcing every segment driver to implement a dummy "return 0"
function, handle NULL capable segop function pointer as "no copabilities
supported" shorthand.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg_vn.c
          +++ new/usr/src/uts/common/vm/seg_vn.c
↓ open down ↓ 125 lines elided ↑ open up ↑
 126  126  static int      segvn_advise(struct seg *seg, caddr_t addr, size_t len,
 127  127                      uint_t behav);
 128  128  static void     segvn_dump(struct seg *seg);
 129  129  static int      segvn_pagelock(struct seg *seg, caddr_t addr, size_t len,
 130  130                      struct page ***ppp, enum lock_type type, enum seg_rw rw);
 131  131  static int      segvn_setpagesize(struct seg *seg, caddr_t addr, size_t len,
 132  132                      uint_t szc);
 133  133  static int      segvn_getmemid(struct seg *seg, caddr_t addr,
 134  134                      memid_t *memidp);
 135  135  static lgrp_mem_policy_info_t   *segvn_getpolicy(struct seg *, caddr_t);
 136      -static int      segvn_capable(struct seg *seg, segcapability_t capable);
 137  136  static int      segvn_inherit(struct seg *, caddr_t, size_t, uint_t);
 138  137  
 139  138  struct  seg_ops segvn_ops = {
 140  139          .dup            = segvn_dup,
 141  140          .unmap          = segvn_unmap,
 142  141          .free           = segvn_free,
 143  142          .fault          = segvn_fault,
 144  143          .faulta         = segvn_faulta,
 145  144          .setprot        = segvn_setprot,
 146  145          .checkprot      = segvn_checkprot,
↓ open down ↓ 4 lines elided ↑ open up ↑
 151  150          .getprot        = segvn_getprot,
 152  151          .getoffset      = segvn_getoffset,
 153  152          .gettype        = segvn_gettype,
 154  153          .getvp          = segvn_getvp,
 155  154          .advise         = segvn_advise,
 156  155          .dump           = segvn_dump,
 157  156          .pagelock       = segvn_pagelock,
 158  157          .setpagesize    = segvn_setpagesize,
 159  158          .getmemid       = segvn_getmemid,
 160  159          .getpolicy      = segvn_getpolicy,
 161      -        .capable        = segvn_capable,
 162  160          .inherit        = segvn_inherit,
 163  161  };
 164  162  
 165  163  /*
 166  164   * Common zfod structures, provided as a shorthand for others to use.
 167  165   */
 168  166  static segvn_crargs_t zfod_segvn_crargs =
 169  167          SEGVN_ZFOD_ARGS(PROT_ZFOD, PROT_ALL);
 170  168  static segvn_crargs_t kzfod_segvn_crargs =
 171  169          SEGVN_ZFOD_ARGS(PROT_ZFOD & ~PROT_USER,
↓ open down ↓ 9304 lines elided ↑ open up ↑
9476 9474                  }
9477 9475          } else {
9478 9476                  amp = svn_data->amp;
9479 9477                  anon_index = svn_data->anon_index + seg_page(seg, addr);
9480 9478                  vp = svn_data->vp;
9481 9479                  vn_off = svn_data->offset + (uintptr_t)(addr - seg->s_base);
9482 9480                  policy_info = lgrp_shm_policy_get(amp, anon_index, vp, vn_off);
9483 9481          }
9484 9482  
9485 9483          return (policy_info);
9486      -}
9487      -
9488      -/*ARGSUSED*/
9489      -static int
9490      -segvn_capable(struct seg *seg, segcapability_t capability)
9491      -{
9492      -        return (0);
9493 9484  }
9494 9485  
9495 9486  /*
9496 9487   * Bind text vnode segment to an amp. If we bind successfully mappings will be
9497 9488   * established to per vnode mapping per lgroup amp pages instead of to vnode
9498 9489   * pages. There's one amp per vnode text mapping per lgroup. Many processes
9499 9490   * may share the same text replication amp. If a suitable amp doesn't already
9500 9491   * exist in svntr hash table create a new one.  We may fail to bind to amp if
9501 9492   * segment is not eligible for text replication.  Code below first checks for
9502 9493   * these conditions. If binding is successful segment tr_state is set to on
↓ open down ↓ 606 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX