Print this page
5255 uts shouldn't open-code ISP2

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/vm/seg_kmem.c
          +++ new/usr/src/uts/common/vm/seg_kmem.c
↓ open down ↓ 1280 lines elided ↑ open up ↑
1281 1281                          if (lpthrt >= segkmem_lpthrottle_max) {
1282 1282                                  lpthrt = atomic_cas_ulong(lpthrtp, lpthrt,
1283 1283                                      segkmem_lpthrottle_max / 4);
1284 1284                          }
1285 1285  
1286 1286                          /*
1287 1287                           * when we get above throttle start do an exponential
1288 1288                           * backoff at trying large pages and reaping
1289 1289                           */
1290 1290                          if (lpthrt > segkmem_lpthrottle_start &&
1291      -                            (lpthrt & (lpthrt - 1))) {
     1291 +                            !ISP2(lpthrt)) {
1292 1292                                  lpcb->allocs_throttled++;
1293 1293                                  lpthrt--;
1294      -                                if ((lpthrt & (lpthrt - 1)) == 0)
     1294 +                                if (ISP2(lpthrt))
1295 1295                                          kmem_reap();
1296 1296                                  return (segkmem_alloc(vmp, size, vmflag));
1297 1297                          }
1298 1298                  }
1299 1299  
1300 1300                  if (!(vmflag & VM_NOSLEEP) &&
1301 1301                      segkmem_heaplp_quantum >= (8 * kmemlp_qnt) &&
1302 1302                      vmem_size(kmem_lp_arena, VMEM_FREE) <= kmemlp_qnt &&
1303 1303                      asize < (segkmem_heaplp_quantum - kmemlp_qnt)) {
1304 1304  
↓ open down ↓ 163 lines elided ↑ open up ↑
1468 1468                   */
1469 1469                  vmem_xfree(heap_arena, heap_lp_base,
1470 1470                      heap_lp_end - heap_lp_base);
1471 1471                  heap_lp_base = NULL;
1472 1472                  heap_lp_end = NULL;
1473 1473                  segkmem_lpsize = PAGESIZE;
1474 1474                  return (0);
1475 1475          }
1476 1476  
1477 1477          /* set heap_lp quantum if necessary */
1478      -        if (segkmem_heaplp_quantum == 0 ||
1479      -            (segkmem_heaplp_quantum & (segkmem_heaplp_quantum - 1)) ||
     1478 +        if (segkmem_heaplp_quantum == 0 || !ISP2(segkmem_heaplp_quantum) ||
1480 1479              P2PHASE(segkmem_heaplp_quantum, segkmem_lpsize)) {
1481 1480                  segkmem_heaplp_quantum = segkmem_lpsize;
1482 1481          }
1483 1482  
1484 1483          /* set kmem_lp quantum if necessary */
1485      -        if (segkmem_kmemlp_quantum == 0 ||
1486      -            (segkmem_kmemlp_quantum & (segkmem_kmemlp_quantum - 1)) ||
     1484 +        if (segkmem_kmemlp_quantum == 0 || !ISP2(segkmem_kmemlp_quantum) ||
1487 1485              segkmem_kmemlp_quantum > segkmem_heaplp_quantum) {
1488 1486                  segkmem_kmemlp_quantum = segkmem_heaplp_quantum;
1489 1487          }
1490 1488  
1491 1489          /* set total amount of memory allowed for large page kernel heap */
1492 1490          if (segkmem_kmemlp_max == 0) {
1493 1491                  if (segkmem_kmemlp_pcnt == 0 || segkmem_kmemlp_pcnt > 100)
1494 1492                          segkmem_kmemlp_pcnt = 12;
1495 1493                  segkmem_kmemlp_max = (memtotal * segkmem_kmemlp_pcnt) / 100;
1496 1494          }
↓ open down ↓ 149 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX