3484 policy = LGRP_MEM_POLICY_RANDOM_PSET;
3485 else
3486 policy = LGRP_MEM_POLICY_RANDOM;
3487 } else
3488 /*
3489 * Apply default policy for private memory and
3490 * shared memory under the respective random
3491 * threshold.
3492 */
3493 policy = lgrp_mem_default_policy;
3494
3495 return (policy);
3496 }
3497
3498 /*
3499 * Get memory allocation policy for this segment
3500 */
3501 lgrp_mem_policy_info_t *
3502 lgrp_mem_policy_get(struct seg *seg, caddr_t vaddr)
3503 {
3504 extern struct seg_ops segspt_ops;
3505 extern struct seg_ops segspt_shmops;
3506
3507 /*
3508 * This is for binary compatibility to protect against third party
3509 * segment drivers which haven't recompiled to allow for
3510 * segop_getpolicy()
3511 */
3512 if (seg->s_ops != &segvn_ops && seg->s_ops != &segspt_ops &&
3513 seg->s_ops != &segspt_shmops)
3514 return (NULL);
3515
3516 return (segop_getpolicy(seg, vaddr));
3517 }
3518
3519 /*
3520 * Set policy for allocating private memory given desired policy, policy info,
3521 * size in bytes of memory that policy is being applied.
3522 * Return 0 if policy wasn't set already and 1 if policy was set already
3523 */
3524 int
3525 lgrp_privm_policy_set(lgrp_mem_policy_t policy,
3526 lgrp_mem_policy_info_t *policy_info, size_t size)
3527 {
3528
3529 ASSERT(policy_info != NULL);
3530
3531 if (policy == LGRP_MEM_POLICY_DEFAULT)
3532 policy = lgrp_mem_policy_default(size, MAP_PRIVATE);
3533
3534 /*
3535 * Policy set already?
|
3484 policy = LGRP_MEM_POLICY_RANDOM_PSET;
3485 else
3486 policy = LGRP_MEM_POLICY_RANDOM;
3487 } else
3488 /*
3489 * Apply default policy for private memory and
3490 * shared memory under the respective random
3491 * threshold.
3492 */
3493 policy = lgrp_mem_default_policy;
3494
3495 return (policy);
3496 }
3497
3498 /*
3499 * Get memory allocation policy for this segment
3500 */
3501 lgrp_mem_policy_info_t *
3502 lgrp_mem_policy_get(struct seg *seg, caddr_t vaddr)
3503 {
3504 return (segop_getpolicy(seg, vaddr));
3505 }
3506
3507 /*
3508 * Set policy for allocating private memory given desired policy, policy info,
3509 * size in bytes of memory that policy is being applied.
3510 * Return 0 if policy wasn't set already and 1 if policy was set already
3511 */
3512 int
3513 lgrp_privm_policy_set(lgrp_mem_policy_t policy,
3514 lgrp_mem_policy_info_t *policy_info, size_t size)
3515 {
3516
3517 ASSERT(policy_info != NULL);
3518
3519 if (policy == LGRP_MEM_POLICY_DEFAULT)
3520 policy = lgrp_mem_policy_default(size, MAP_PRIVATE);
3521
3522 /*
3523 * Policy set already?
|