Print this page
patch as-lock-macro-simplification

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/exec.c
          +++ new/usr/src/uts/common/os/exec.c
↓ open down ↓ 1265 lines elided ↑ open up ↑
1266 1266                           * We need to be careful how we zero-fill the last page
1267 1267                           * if the segment protection does not include
1268 1268                           * PROT_WRITE. Using as_setprot() can cause the VM
1269 1269                           * segment code to call segvn_vpage(), which must
1270 1270                           * allocate a page struct for each page in the segment.
1271 1271                           * If we have a very large segment, this may fail, so
1272 1272                           * we have to check for that, even though we ignore
1273 1273                           * other return values from as_setprot.
1274 1274                           */
1275 1275  
1276      -                        AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
     1276 +                        AS_LOCK_ENTER(as, RW_READER);
1277 1277                          seg = as_segat(curproc->p_as, (caddr_t)end);
1278 1278                          if (seg != NULL)
1279 1279                                  SEGOP_GETPROT(seg, (caddr_t)end, zfoddiff - 1,
1280 1280                                      &zprot);
1281      -                        AS_LOCK_EXIT(as, &as->a_lock);
     1281 +                        AS_LOCK_EXIT(as);
1282 1282  
1283 1283                          if (seg != NULL && (zprot & PROT_WRITE) == 0) {
1284 1284                                  if (as_setprot(as, (caddr_t)end, zfoddiff - 1,
1285 1285                                      zprot | PROT_WRITE) == ENOMEM) {
1286 1286                                          error = ENOMEM;
1287 1287                                          goto bad;
1288 1288                                  }
1289 1289                          }
1290 1290  
1291 1291                          if (on_fault(&ljb)) {
↓ open down ↓ 742 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX