Print this page
OS-881 To workaround OS-580 add support to only invalidate mappings from a single process

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 ↓ 7300 lines elided ↑ open up ↑
7301 7301                  segvn_purge(seg);
7302 7302                  if (svd->amp->a_softlockcnt > 0 || svd->softlockcnt > 0) {
7303 7303                          SEGVN_LOCK_EXIT(seg->s_as, &svd->lock);
7304 7304                          return (EAGAIN);
7305 7305                  }
7306 7306          }
7307 7307  
7308 7308          vpp = svd->vpage;
7309 7309          offset = svd->offset + (uintptr_t)(addr - seg->s_base);
7310 7310          bflags = ((flags & MS_ASYNC) ? B_ASYNC : 0) |
7311      -            ((flags & MS_INVALIDATE) ? B_INVAL : 0);
     7311 +            ((flags & MS_INVALIDATE) ? B_INVAL : 0) |
     7312 +            ((flags & MS_INVALCURPROC) ? (B_INVALCURONLY | B_INVAL) : 0);
7312 7313  
7313 7314          if (attr) {
7314 7315                  pageprot = attr & ~(SHARED|PRIVATE);
7315 7316                  segtype = (attr & SHARED) ? MAP_SHARED : MAP_PRIVATE;
7316 7317  
7317 7318                  /*
7318 7319                   * We are done if the segment types don't match
7319 7320                   * or if we have segment level protections and
7320 7321                   * they don't match.
7321 7322                   */
↓ open down ↓ 4 lines elided ↑ open up ↑
7326 7327                  if (vpp == NULL) {
7327 7328                          if (svd->prot != pageprot) {
7328 7329                                  SEGVN_LOCK_EXIT(seg->s_as, &svd->lock);
7329 7330                                  return (0);
7330 7331                          }
7331 7332                          prot = svd->prot;
7332 7333                  } else
7333 7334                          vpp = &svd->vpage[seg_page(seg, addr)];
7334 7335  
7335 7336          } else if (svd->vp && svd->amp == NULL &&
7336      -            (flags & MS_INVALIDATE) == 0) {
     7337 +            (flags & (MS_INVALIDATE | MS_INVALCURPROC)) == 0) {
7337 7338  
7338 7339                  /*
7339      -                 * No attributes, no anonymous pages and MS_INVALIDATE flag
7340      -                 * is not on, just use one big request.
     7340 +                 * No attributes, no anonymous pages and MS_INVAL* flags
     7341 +                 * are not on, just use one big request.
7341 7342                   */
7342 7343                  err = VOP_PUTPAGE(svd->vp, (offset_t)offset, len,
7343 7344                      bflags, svd->cred, NULL);
7344 7345                  SEGVN_LOCK_EXIT(seg->s_as, &svd->lock);
7345 7346                  return (err);
7346 7347          }
7347 7348  
7348 7349          if ((amp = svd->amp) != NULL)
7349 7350                  anon_index = svd->anon_index + seg_page(seg, addr);
7350 7351  
↓ open down ↓ 31 lines elided ↑ open up ↑
7382 7383                  }
7383 7384  
7384 7385                  /*
7385 7386                   * See if any of these pages are locked --  if so, then we
7386 7387                   * will have to truncate an invalidate request at the first
7387 7388                   * locked one. We don't need the page_struct_lock to test
7388 7389                   * as this is only advisory; even if we acquire it someone
7389 7390                   * might race in and lock the page after we unlock and before
7390 7391                   * we do the PUTPAGE, then PUTPAGE simply does nothing.
7391 7392                   */
7392      -                if (flags & MS_INVALIDATE) {
     7393 +                if (flags & (MS_INVALIDATE | MS_INVALCURPROC)) {
7393 7394                          if ((pp = page_lookup(vp, off, SE_SHARED)) != NULL) {
7394 7395                                  if (pp->p_lckcnt != 0 || pp->p_cowcnt != 0) {
7395 7396                                          page_unlock(pp);
7396 7397                                          SEGVN_LOCK_EXIT(seg->s_as, &svd->lock);
7397 7398                                          return (EBUSY);
7398 7399                                  }
7399 7400                                  if (ap != NULL && pp->p_szc != 0 &&
7400 7401                                      page_tryupgrade(pp)) {
7401 7402                                          if (pp->p_lckcnt == 0 &&
7402 7403                                              pp->p_cowcnt == 0) {
↓ open down ↓ 2931 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX