17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5c6402783Sakolb * Common Development and Distribution License (the "License"). 6c6402783Sakolb * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21c6402783Sakolb 227c478bd9Sstevel@tonic-gate /* 23fb2f18f8Sesaxe * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _LGRP_H 287c478bd9Sstevel@tonic-gate #define _LGRP_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * locality group definitions for kernel 347c478bd9Sstevel@tonic-gate */ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <sys/types.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #define LGRP_NONE (-1) /* non-existent lgroup ID */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #if (!defined(_KERNEL) && !defined(_KMEMUSER)) 457c478bd9Sstevel@tonic-gate typedef struct lgrp_mem_policy_info { int opaque[2]; } lgrp_mem_policy_info_t; 467c478bd9Sstevel@tonic-gate #endif /* !_KERNEL && !_KMEMUSER */ 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #if (defined(_KERNEL) || defined(_KMEMUSER)) 497c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h> 507c478bd9Sstevel@tonic-gate #include <sys/bitmap.h> 517c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 527c478bd9Sstevel@tonic-gate #include <vm/anon.h> 537c478bd9Sstevel@tonic-gate #include <vm/seg.h> 547c478bd9Sstevel@tonic-gate #include <sys/lgrp_user.h> 557c478bd9Sstevel@tonic-gate #include <sys/param.h> 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate typedef uint32_t lgrp_load_t; /* lgrp_loadavg type */ 587c478bd9Sstevel@tonic-gate typedef uintptr_t lgrp_handle_t; /* lgrp handle */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define LGRP_NONE_SUCH LGRP_NONE /* non-existent lgroup ID */ 617c478bd9Sstevel@tonic-gate /* null platform handle */ 627c478bd9Sstevel@tonic-gate #define LGRP_NULL_HANDLE ((lgrp_handle_t)0xbadbad) 637c478bd9Sstevel@tonic-gate #define LGRP_DEFAULT_HANDLE ((lgrp_handle_t)0xbabecafe) /* uma handle */ 647c478bd9Sstevel@tonic-gate #define LGRP_ROOTID (0) /* root lgroup ID */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Maximum number of lgrps a platform may define. 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #define NLGRPS_MAX 64 717c478bd9Sstevel@tonic-gate #define NLGRP_LEAVES_MAX 24 727c478bd9Sstevel@tonic-gate #define LGRP_LOADAVG_MAX UINT32_MAX 737c478bd9Sstevel@tonic-gate #define LPL_RSET_MAX NLGRP_LEAVES_MAX 747c478bd9Sstevel@tonic-gate #define LPL_RSET_ARRYSZ (LPL_RSET_MAX + 1) 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * The load-average we expect for one cpu-bound thread's worth of load 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate #define LGRP_LOADAVG_THREAD_MAX 65516 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* 827c478bd9Sstevel@tonic-gate * The input to the load-average generating function for one cpu-bound thread's 837c478bd9Sstevel@tonic-gate * worth of load 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define LGRP_LOADAVG_IN_THREAD_MAX 128 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate /* 897c478bd9Sstevel@tonic-gate * LPL actions 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate typedef enum { 937c478bd9Sstevel@tonic-gate LPL_INCREMENT, 947c478bd9Sstevel@tonic-gate LPL_DECREMENT 957c478bd9Sstevel@tonic-gate } lpl_act_t; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * lgroup statistics. Most of these are counters that are updated 997c478bd9Sstevel@tonic-gate * dynamically so they are hashed to CPU buckets to reduce cache 1007c478bd9Sstevel@tonic-gate * interference. The remaining statistics are snapshots of kernel 1017c478bd9Sstevel@tonic-gate * data, so they aren't stored in the array of counter stats. 1027c478bd9Sstevel@tonic-gate * 1037c478bd9Sstevel@tonic-gate * For the hashed stats to make sense, you have to sum all the buckets for 1047c478bd9Sstevel@tonic-gate * that stat, hence macros are provided to read the stats. 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #define LGRP_NUM_CPU_BUCKETS 8 /* must be power of 2 */ 1087c478bd9Sstevel@tonic-gate #define LGRP_CPU_BUCKET_MASK (LGRP_NUM_CPU_BUCKETS - 1) 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* 1117c478bd9Sstevel@tonic-gate * Flags for what to do with lgroup memory policy 1127c478bd9Sstevel@tonic-gate * Used for heap and stack where policy is extended to new segments added to 1137c478bd9Sstevel@tonic-gate * the end 1147c478bd9Sstevel@tonic-gate */ 1157c478bd9Sstevel@tonic-gate #define LGRP_MP_FLAG_EXTEND_UP 0x1 /* policy should extend up */ 1167c478bd9Sstevel@tonic-gate #define LGRP_MP_FLAG_EXTEND_DOWN 0x2 /* policy should extend down */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #define LGRP_STAT(stats, bucket, whichstat) \ 1197c478bd9Sstevel@tonic-gate ((stats)->ls_data[bucket][whichstat]) 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* Return a pointer suitable for an atomic 64-bit op on the bucket */ 1227c478bd9Sstevel@tonic-gate #define LGRP_STAT_WRITE_PTR(stats, whichstat) \ 1237c478bd9Sstevel@tonic-gate (&LGRP_STAT(stats, (CPU->cpu_id) & LGRP_CPU_BUCKET_MASK, \ 1247c478bd9Sstevel@tonic-gate whichstat)) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* Sum up all the buckets and return the value in 'val' */ 1277c478bd9Sstevel@tonic-gate #define LGRP_STAT_READ(stats, whichstat, val) { \ 1287c478bd9Sstevel@tonic-gate int bkt; \ 1297c478bd9Sstevel@tonic-gate for (val = 0, bkt = 0; bkt < LGRP_NUM_CPU_BUCKETS; bkt++) \ 1307c478bd9Sstevel@tonic-gate val += LGRP_STAT(stats, bkt, whichstat); \ 1317c478bd9Sstevel@tonic-gate } 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate /* Reset all buckets for the stat to 0 */ 1347c478bd9Sstevel@tonic-gate #define LGRP_STAT_RESET(stats, stat) { \ 1357c478bd9Sstevel@tonic-gate int i; \ 1367c478bd9Sstevel@tonic-gate for (i = 0; i < LGRP_NUM_CPU_BUCKETS; i++) \ 1377c478bd9Sstevel@tonic-gate LGRP_STAT(stats, i, stat) = 0; \ 1387c478bd9Sstevel@tonic-gate } 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate /* 1417c478bd9Sstevel@tonic-gate * Define all of the statistics that are kept for lgrp kstats, 1427c478bd9Sstevel@tonic-gate * and their corresponding text names. 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate typedef enum lgrp_stat_types { 1467c478bd9Sstevel@tonic-gate LGRP_NUM_MIGR, /* # migrations away from this lgrp */ 1477c478bd9Sstevel@tonic-gate LGRP_NUM_ALLOC_FAIL, /* # times alloc fails for chosen lgrp */ 1487c478bd9Sstevel@tonic-gate LGRP_PM_SRC_PGS, /* # pages migrated from this lgrp */ 1497c478bd9Sstevel@tonic-gate LGRP_PM_DEST_PGS, /* # pages migrated to this lgrp */ 1507c478bd9Sstevel@tonic-gate LGRP_PM_FAIL_ALLOC_PGS, /* # pages failed to migrate to this lgrp */ 1517c478bd9Sstevel@tonic-gate LGRP_PM_FAIL_LOCK_PGS, /* # pages failed to migrate from this lgrp */ 1527c478bd9Sstevel@tonic-gate LGRP_PMM_PGS, /* # pages marked to migrate from this lgrp */ 1537c478bd9Sstevel@tonic-gate LGRP_PMM_FAIL_PGS, /* # pages marked to migrate from this lgrp */ 1547c478bd9Sstevel@tonic-gate LGRP_NUM_DEFAULT, /* # of times default policy applied */ 1557c478bd9Sstevel@tonic-gate LGRP_NUM_NEXT, /* # of times next touch policy applied */ 1567c478bd9Sstevel@tonic-gate LGRP_NUM_RANDOM, /* # of times random policy applied */ 1577c478bd9Sstevel@tonic-gate LGRP_NUM_RANDOM_PROC, /* # of times random proc policy applied */ 1587c478bd9Sstevel@tonic-gate LGRP_NUM_RANDOM_PSET, /* # of times random pset policy applied */ 1597c478bd9Sstevel@tonic-gate LGRP_NUM_ROUNDROBIN, /* # of times round robin policy applied */ 1602cb27123Saguzovsk LGRP_NUM_NEXT_SEG, /* # of times next to seg policy applied */ 1617c478bd9Sstevel@tonic-gate LGRP_NUM_COUNTER_STATS, /* always last */ 1627c478bd9Sstevel@tonic-gate LGRP_CTR_STATS_ALLOC = 16 /* cache-align pad - multiple of 8 */ 1637c478bd9Sstevel@tonic-gate /* always keep >= LGRP_NUM_COUNTER_STATS */ 1647c478bd9Sstevel@tonic-gate } lgrp_stat_t; 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate typedef enum lgrp_snap_stat_types { 1677c478bd9Sstevel@tonic-gate LGRP_NUM_CPUS, /* number of CPUs */ 1687c478bd9Sstevel@tonic-gate LGRP_NUM_PG_FREE, /* # of free pages */ 1697c478bd9Sstevel@tonic-gate LGRP_NUM_PG_AVAIL, /* # of allocatable physical pages */ 1707c478bd9Sstevel@tonic-gate LGRP_NUM_PG_INSTALL, /* # of installed physical pages */ 171c6402783Sakolb LGRP_LOADAVG, /* unscaled load average of this lgrp */ 172c6402783Sakolb LGRP_LOADAVG_SCALE, /* load unit of one CPU bound thread */ 1737c478bd9Sstevel@tonic-gate LGRP_NUM_SNAPSHOT_STATS /* always last */ 1747c478bd9Sstevel@tonic-gate } lgrp_snap_stat_t; 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate #define LGRP_KSTAT_NAMES \ 1777c478bd9Sstevel@tonic-gate static char *lgrp_kstat_names[] = { \ 1787c478bd9Sstevel@tonic-gate \ 1797c478bd9Sstevel@tonic-gate /* Counter stats */ \ 1807c478bd9Sstevel@tonic-gate "lwp migrations", \ 1817c478bd9Sstevel@tonic-gate "alloc fail", \ 1827c478bd9Sstevel@tonic-gate "pages migrated from", \ 1837c478bd9Sstevel@tonic-gate "pages migrated to", \ 1847c478bd9Sstevel@tonic-gate "pages failed to migrate to", \ 1857c478bd9Sstevel@tonic-gate "pages failed to migrate from", \ 1867c478bd9Sstevel@tonic-gate "pages marked for migration", \ 1877c478bd9Sstevel@tonic-gate "pages failed to mark", \ 1887c478bd9Sstevel@tonic-gate "default policy", \ 1897c478bd9Sstevel@tonic-gate "next-touch policy", \ 1907c478bd9Sstevel@tonic-gate "random policy", \ 1917c478bd9Sstevel@tonic-gate "span process policy", \ 1927c478bd9Sstevel@tonic-gate "span psrset policy", \ 1937c478bd9Sstevel@tonic-gate "round robin policy", \ 1942cb27123Saguzovsk "next-seg policy", \ 1957c478bd9Sstevel@tonic-gate \ 1967c478bd9Sstevel@tonic-gate /* Snapshot stats */ \ 1977c478bd9Sstevel@tonic-gate "cpus", \ 1987c478bd9Sstevel@tonic-gate "pages free", \ 1997c478bd9Sstevel@tonic-gate "pages avail", \ 2007c478bd9Sstevel@tonic-gate "pages installed", \ 201c6402783Sakolb "load average", \ 202c6402783Sakolb "loadscale" \ 2037c478bd9Sstevel@tonic-gate } 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate #define LGRP_NUM_STATS ((int)LGRP_NUM_COUNTER_STATS + \ 2067c478bd9Sstevel@tonic-gate (int)LGRP_NUM_SNAPSHOT_STATS) 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate /* 2097c478bd9Sstevel@tonic-gate * The contents of this structure are opaque and should only be 2107c478bd9Sstevel@tonic-gate * accessed through the LGRP_STAT macro. 2117c478bd9Sstevel@tonic-gate */ 2127c478bd9Sstevel@tonic-gate struct lgrp_stats { 2137c478bd9Sstevel@tonic-gate int64_t ls_data[LGRP_NUM_CPU_BUCKETS][LGRP_CTR_STATS_ALLOC]; 2147c478bd9Sstevel@tonic-gate }; 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate /* The kernel's version of a bitmap of lgroups */ 2177c478bd9Sstevel@tonic-gate typedef uint64_t klgrpset_t; 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate /* 2207c478bd9Sstevel@tonic-gate * This really belongs in memnode.h, but it must be defined here to avoid 2217c478bd9Sstevel@tonic-gate * recursive inclusion problems. Note that memnode.h includes this header. 2227c478bd9Sstevel@tonic-gate */ 2237c478bd9Sstevel@tonic-gate typedef uint64_t mnodeset_t; 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gate /* 2267c478bd9Sstevel@tonic-gate * lgroup structure 2277c478bd9Sstevel@tonic-gate * 2287c478bd9Sstevel@tonic-gate * Visible to generic code and contains the lgroup ID, CPUs in this lgroup, 2297c478bd9Sstevel@tonic-gate * and a platform handle used to identify this lgroup to the lgroup platform 2307c478bd9Sstevel@tonic-gate * support code 2317c478bd9Sstevel@tonic-gate */ 2327c478bd9Sstevel@tonic-gate typedef struct lgrp { 2337c478bd9Sstevel@tonic-gate 2347c478bd9Sstevel@tonic-gate lgrp_id_t lgrp_id; /* which lgroup */ 2357c478bd9Sstevel@tonic-gate int lgrp_latency; 2367c478bd9Sstevel@tonic-gate lgrp_handle_t lgrp_plathand; /* handle for platform calls */ 2377c478bd9Sstevel@tonic-gate struct lgrp *lgrp_parent; /* parent lgroup */ 2387c478bd9Sstevel@tonic-gate uint_t lgrp_reserved1; /* filler */ 2397c478bd9Sstevel@tonic-gate uint_t lgrp_childcnt; /* number of children lgroups */ 2407c478bd9Sstevel@tonic-gate klgrpset_t lgrp_children; /* children lgroups */ 2417c478bd9Sstevel@tonic-gate klgrpset_t lgrp_leaves; /* (direct decendant) leaf lgroups */ 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate /* 2447c478bd9Sstevel@tonic-gate * set of lgroups containing a given type of resource 2457c478bd9Sstevel@tonic-gate * at this level of locality 2467c478bd9Sstevel@tonic-gate */ 2477c478bd9Sstevel@tonic-gate klgrpset_t lgrp_set[LGRP_RSRC_COUNT]; 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate mnodeset_t lgrp_mnodes; /* set of memory nodes in this lgroup */ 2507c478bd9Sstevel@tonic-gate uint_t lgrp_nmnodes; /* number of memnodes */ 2517c478bd9Sstevel@tonic-gate uint_t lgrp_reserved2; /* filler */ 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate struct cpu *lgrp_cpu; /* pointer to a cpu may be null */ 2547c478bd9Sstevel@tonic-gate uint_t lgrp_cpucnt; /* number of cpus in this lgrp */ 2557c478bd9Sstevel@tonic-gate kstat_t *lgrp_kstat; /* per-lgrp kstats */ 2567c478bd9Sstevel@tonic-gate } lgrp_t; 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate /* 2597c478bd9Sstevel@tonic-gate * lgroup load average structure 2607c478bd9Sstevel@tonic-gate */ 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate typedef struct lgrp_ld { 2637c478bd9Sstevel@tonic-gate lgrp_load_t lpl_loadavg; /* load average */ 2647c478bd9Sstevel@tonic-gate uint_t lpl_ncpu; /* how many cpus */ 2657c478bd9Sstevel@tonic-gate lgrp_id_t lpl_lgrpid; /* which group this lpl part of */ 2667c478bd9Sstevel@tonic-gate lgrp_t *lpl_lgrp; /* ptr to lpl's lgrp */ 2677c478bd9Sstevel@tonic-gate struct lgrp_ld *lpl_parent; /* lpl of parent lgrp */ 2687c478bd9Sstevel@tonic-gate struct cpu *lpl_cpus; /* list of cpus in lpl */ 2697c478bd9Sstevel@tonic-gate /* NULL for non-leaf lgrps */ 2707c478bd9Sstevel@tonic-gate uint_t lpl_nrset; /* no. of leaf lpls for lgrp */ 2717c478bd9Sstevel@tonic-gate int lpl_hint; /* where to start looking in parent */ 2727c478bd9Sstevel@tonic-gate hrtime_t lpl_homed_time; /* time of last homing to this lpl */ 2737c478bd9Sstevel@tonic-gate struct lgrp_ld *lpl_rset[LPL_RSET_ARRYSZ]; /* leaf lpls for lgrp */ 2747c478bd9Sstevel@tonic-gate /* contains ptr to self for leaf lgrp */ 2757c478bd9Sstevel@tonic-gate } lpl_t; 2767c478bd9Sstevel@tonic-gate 2777c478bd9Sstevel@tonic-gate /* 2787c478bd9Sstevel@tonic-gate * 1 << LGRP_MAX_EFFECT_SHFT == lgrp_loadavg_max_effect 2797c478bd9Sstevel@tonic-gate */ 2807c478bd9Sstevel@tonic-gate #define LGRP_MAX_EFFECT_SHFT 16 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /* 2837c478bd9Sstevel@tonic-gate * Operations handled by lgrp_config() 2847c478bd9Sstevel@tonic-gate */ 2857c478bd9Sstevel@tonic-gate typedef enum lgrp_config_flag { 2867c478bd9Sstevel@tonic-gate LGRP_CONFIG_NOP, 2877c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPU_ADD, 2887c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPU_DEL, 2897c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPU_ONLINE, 2907c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPU_OFFLINE, 2917c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPUPART_ADD, 2927c478bd9Sstevel@tonic-gate LGRP_CONFIG_CPUPART_DEL, 2937c478bd9Sstevel@tonic-gate LGRP_CONFIG_MEM_ADD, 2947c478bd9Sstevel@tonic-gate LGRP_CONFIG_MEM_DEL, 2957c478bd9Sstevel@tonic-gate LGRP_CONFIG_MEM_RENAME, 2967c478bd9Sstevel@tonic-gate LGRP_CONFIG_GEN_UPDATE, 2977c478bd9Sstevel@tonic-gate LGRP_CONFIG_FLATTEN, 29803400a71Sjjc LGRP_CONFIG_LAT_CHANGE_ALL, 29903400a71Sjjc LGRP_CONFIG_LAT_CHANGE 3007c478bd9Sstevel@tonic-gate } lgrp_config_flag_t; 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate /* 3037c478bd9Sstevel@tonic-gate * Memory allocation policies 3047c478bd9Sstevel@tonic-gate */ 3057c478bd9Sstevel@tonic-gate typedef enum lgrp_mem_policy { 3067c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_DEFAULT, 3077c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_NEXT, /* near LWP to next touch */ 3087c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_RANDOM_PROC, /* randomly across process */ 3097c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_RANDOM_PSET, /* randomly across processor set */ 3107c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_RANDOM, /* randomly across all lgroups */ 3117c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_ROUNDROBIN, /* round robin across all lgroups */ 3127c478bd9Sstevel@tonic-gate LGRP_MEM_POLICY_NEXT_CPU, /* Near next CPU to touch memory */ 3132cb27123Saguzovsk LGRP_MEM_POLICY_NEXT_SEG, /* lgrp specified directly by seg */ 3147c478bd9Sstevel@tonic-gate LGRP_NUM_MEM_POLICIES 3157c478bd9Sstevel@tonic-gate } lgrp_mem_policy_t; 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate /* 3187c478bd9Sstevel@tonic-gate * Search scopes for finding resouces 3197c478bd9Sstevel@tonic-gate */ 3207c478bd9Sstevel@tonic-gate typedef enum lgrp_res_ss { 3217c478bd9Sstevel@tonic-gate LGRP_SRCH_LOCAL, /* Search local lgroup only */ 3227c478bd9Sstevel@tonic-gate LGRP_SRCH_HIER /* Search entire hierarchy */ 3237c478bd9Sstevel@tonic-gate } lgrp_res_ss_t; 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * Cookie used for lgrp mnode selection 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate typedef struct lgrp_mnode_cookie { 3297c478bd9Sstevel@tonic-gate lgrp_t *lmc_lgrp; /* lgrp under consideration */ 3307c478bd9Sstevel@tonic-gate mnodeset_t lmc_nodes; /* nodes not yet tried in lgrp */ 3317c478bd9Sstevel@tonic-gate int lmc_cnt; /* how many nodes in untried set */ 3327c478bd9Sstevel@tonic-gate mnodeset_t lmc_tried; /* nodes already tried */ 3337c478bd9Sstevel@tonic-gate int lmc_ntried; /* how many nodes in tried set */ 3347c478bd9Sstevel@tonic-gate lgrp_res_ss_t lmc_scope; /* consider non-local nodes? */ 3357c478bd9Sstevel@tonic-gate ushort_t lmc_rand; /* a "random" number */ 3367c478bd9Sstevel@tonic-gate } lgrp_mnode_cookie_t; 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate /* 3397c478bd9Sstevel@tonic-gate * Information needed to implement memory allocation policy 3407c478bd9Sstevel@tonic-gate */ 3417c478bd9Sstevel@tonic-gate typedef struct lgrp_mem_policy_info { 3427c478bd9Sstevel@tonic-gate int mem_policy; /* memory allocation policy */ 3432cb27123Saguzovsk lgrp_id_t mem_lgrpid; /* lgroup id */ 3447c478bd9Sstevel@tonic-gate } lgrp_mem_policy_info_t; 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate /* 3477c478bd9Sstevel@tonic-gate * Shared memory policy segment 3487c478bd9Sstevel@tonic-gate */ 3497c478bd9Sstevel@tonic-gate typedef struct lgrp_shm_policy_seg { 3507c478bd9Sstevel@tonic-gate u_offset_t shm_off; /* offset into shared object */ 3517c478bd9Sstevel@tonic-gate size_t shm_size; /* size of segment */ 3527c478bd9Sstevel@tonic-gate lgrp_mem_policy_info_t shm_policy; /* memory allocation policy */ 3537c478bd9Sstevel@tonic-gate avl_node_t shm_tree; /* AVL tree */ 3547c478bd9Sstevel@tonic-gate } lgrp_shm_policy_seg_t; 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate /* 3577c478bd9Sstevel@tonic-gate * Shared memory locality info 3587c478bd9Sstevel@tonic-gate */ 3597c478bd9Sstevel@tonic-gate typedef struct lgrp_shm_locality { 3607c478bd9Sstevel@tonic-gate size_t loc_count; /* reference count */ 3617c478bd9Sstevel@tonic-gate avl_tree_t *loc_tree; /* policy segment tree */ 3627c478bd9Sstevel@tonic-gate krwlock_t loc_lock; /* protects tree */ 3637c478bd9Sstevel@tonic-gate } lgrp_shm_locality_t; 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate /* 3667c478bd9Sstevel@tonic-gate * Queries that may be made to determine lgroup memory size 3677c478bd9Sstevel@tonic-gate */ 3687c478bd9Sstevel@tonic-gate typedef enum { 3697c478bd9Sstevel@tonic-gate LGRP_MEM_SIZE_FREE, /* number of free pages */ 3707c478bd9Sstevel@tonic-gate LGRP_MEM_SIZE_AVAIL, /* number of pages in phys_avail */ 3717c478bd9Sstevel@tonic-gate LGRP_MEM_SIZE_INSTALL /* number of pages in phys_install */ 3727c478bd9Sstevel@tonic-gate } lgrp_mem_query_t; 3737c478bd9Sstevel@tonic-gate 3747c478bd9Sstevel@tonic-gate /* 3757c478bd9Sstevel@tonic-gate * Argument for the memory copy-rename operation, contains the source and the 3767c478bd9Sstevel@tonic-gate * destination platform handles. 3777c478bd9Sstevel@tonic-gate */ 3787c478bd9Sstevel@tonic-gate typedef struct lgrp_config_mem_rename { 3797c478bd9Sstevel@tonic-gate lgrp_handle_t lmem_rename_from; 3807c478bd9Sstevel@tonic-gate lgrp_handle_t lmem_rename_to; 3817c478bd9Sstevel@tonic-gate } lgrp_config_mem_rename_t; 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate /* Macro to clear an lgroup bitmap */ 3847c478bd9Sstevel@tonic-gate #define klgrpset_clear(klgrpset) \ 3857c478bd9Sstevel@tonic-gate (klgrpset) = (klgrpset_t)0 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate /* Macro to fill an lgroup bitmap */ 3887c478bd9Sstevel@tonic-gate #define klgrpset_fill(klgrpset) \ 3897c478bd9Sstevel@tonic-gate (klgrpset) = (klgrpset_t)(-1) 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate /* Macro to add an lgroup to an lgroup bitmap */ 3927c478bd9Sstevel@tonic-gate #define klgrpset_add(klgrpset, lgrpid) \ 3937c478bd9Sstevel@tonic-gate (klgrpset) |= ((klgrpset_t)1 << (lgrpid)) 3947c478bd9Sstevel@tonic-gate 3957c478bd9Sstevel@tonic-gate /* Macro to delete an lgroup from an lgroup bitmap */ 3967c478bd9Sstevel@tonic-gate #define klgrpset_del(klgrpset, lgrpid) \ 3977c478bd9Sstevel@tonic-gate (klgrpset) &= ~((klgrpset_t)1 << (lgrpid)) 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate /* Macro to copy a klgrpset into another klgrpset */ 4007c478bd9Sstevel@tonic-gate #define klgrpset_copy(klgrpset_to, klgrpset_from) \ 4017c478bd9Sstevel@tonic-gate (klgrpset_to) = (klgrpset_from) 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate /* Macro to perform an 'and' operation on a pair of lgroup bitmaps */ 4047c478bd9Sstevel@tonic-gate #define klgrpset_and(klgrpset_rslt, klgrpset_arg) \ 4057c478bd9Sstevel@tonic-gate (klgrpset_rslt) &= (klgrpset_arg) 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate /* Macro to perform an 'or' operation on a pair of lgroup bitmaps */ 4087c478bd9Sstevel@tonic-gate #define klgrpset_or(klgrpset_rslt, klgrpset_arg) \ 4097c478bd9Sstevel@tonic-gate (klgrpset_rslt) |= (klgrpset_arg) 4107c478bd9Sstevel@tonic-gate 4117c478bd9Sstevel@tonic-gate /* Macro to perform a 'diff' operation on a pair of lgroup bitmaps */ 4127c478bd9Sstevel@tonic-gate #define klgrpset_diff(klgrpset_rslt, klgrpset_arg) \ 4137c478bd9Sstevel@tonic-gate (klgrpset_rslt) &= ~(klgrpset_arg) 4147c478bd9Sstevel@tonic-gate 4157c478bd9Sstevel@tonic-gate /* Macro to check if an lgroup is a member of an lgrpset */ 4167c478bd9Sstevel@tonic-gate #define klgrpset_ismember(klgrpset, lgrpid) \ 4177c478bd9Sstevel@tonic-gate ((klgrpset) & ((klgrpset_t)1 << (lgrpid))) 4187c478bd9Sstevel@tonic-gate 4197c478bd9Sstevel@tonic-gate /* Macro to check if an lgroup bitmap is empty */ 4207c478bd9Sstevel@tonic-gate #define klgrpset_isempty(klgrpset) \ 4217c478bd9Sstevel@tonic-gate ((klgrpset) == (klgrpset_t)0) 4227c478bd9Sstevel@tonic-gate 4237c478bd9Sstevel@tonic-gate /* Macro to check if two lgrpsets intersect */ 4247c478bd9Sstevel@tonic-gate #define klgrpset_intersects(klgrpset1, klgrpset2) \ 4257c478bd9Sstevel@tonic-gate ((klgrpset1) & (klgrpset2)) 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate /* Macro to count the number of members in an lgrpset */ 4287c478bd9Sstevel@tonic-gate #define klgrpset_nlgrps(klgrpset, count) \ 4297c478bd9Sstevel@tonic-gate { \ 4307c478bd9Sstevel@tonic-gate lgrp_id_t lgrpid; \ 4317c478bd9Sstevel@tonic-gate for (lgrpid = 0, count = 0; lgrpid <= lgrp_alloc_max; lgrpid++) {\ 4327c478bd9Sstevel@tonic-gate if (klgrpset_ismember(klgrpset, lgrpid)) \ 4337c478bd9Sstevel@tonic-gate count++; \ 4347c478bd9Sstevel@tonic-gate } \ 4357c478bd9Sstevel@tonic-gate } 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate /* Macro to get total memory size (in bytes) of a given set of lgroups */ 4387c478bd9Sstevel@tonic-gate #define klgrpset_totalsize(klgrpset, size) \ 4397c478bd9Sstevel@tonic-gate { \ 4407c478bd9Sstevel@tonic-gate lgrp_handle_t hand; \ 4417c478bd9Sstevel@tonic-gate lgrp_id_t lgrpid; \ 4427c478bd9Sstevel@tonic-gate \ 4437c478bd9Sstevel@tonic-gate for (lgrpid = 0, size = 0; lgrpid <= lgrp_alloc_max; lgrpid++) {\ 4447c478bd9Sstevel@tonic-gate if (klgrpset_ismember(klgrpset, lgrpid) && \ 4457c478bd9Sstevel@tonic-gate lgrp_table[lgrpid]) { \ 4467c478bd9Sstevel@tonic-gate hand = lgrp_table[lgrpid]->lgrp_plathand; \ 4477c478bd9Sstevel@tonic-gate size += lgrp_plat_mem_size(hand, \ 4487c478bd9Sstevel@tonic-gate LGRP_MEM_SIZE_AVAIL) * PAGESIZE; \ 4497c478bd9Sstevel@tonic-gate } \ 4507c478bd9Sstevel@tonic-gate } \ 4517c478bd9Sstevel@tonic-gate } 4527c478bd9Sstevel@tonic-gate 4537c478bd9Sstevel@tonic-gate /* 4547c478bd9Sstevel@tonic-gate * Does this lgroup exist? 4557c478bd9Sstevel@tonic-gate */ 4567c478bd9Sstevel@tonic-gate #define LGRP_EXISTS(lgrp) \ 4577c478bd9Sstevel@tonic-gate (lgrp != NULL && lgrp->lgrp_id != LGRP_NONE) 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate /* 4607c478bd9Sstevel@tonic-gate * Initialize an lgrp_mnode_cookie 4617c478bd9Sstevel@tonic-gate */ 4627c478bd9Sstevel@tonic-gate #define LGRP_MNODE_COOKIE_INIT(c, lgrp, scope) \ 4637c478bd9Sstevel@tonic-gate { \ 4647c478bd9Sstevel@tonic-gate bzero(&(c), sizeof (lgrp_mnode_cookie_t)); \ 4657c478bd9Sstevel@tonic-gate (&(c))->lmc_lgrp = lgrp; \ 4667c478bd9Sstevel@tonic-gate (&(c))->lmc_nodes = lgrp->lgrp_mnodes; \ 4677c478bd9Sstevel@tonic-gate (&(c))->lmc_cnt = lgrp->lgrp_nmnodes; \ 4687c478bd9Sstevel@tonic-gate (&(c))->lmc_scope = scope; \ 4697c478bd9Sstevel@tonic-gate (&(c))->lmc_rand = (ushort_t)gethrtime_unscaled() >> 4; \ 4707c478bd9Sstevel@tonic-gate } 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate /* 4737c478bd9Sstevel@tonic-gate * Upgrade cookie scope from LGRP_SRCH_LOCAL to LGRP_SRCH_HIER. 4747c478bd9Sstevel@tonic-gate */ 4757c478bd9Sstevel@tonic-gate #define LGRP_MNODE_COOKIE_UPGRADE(c) \ 4767c478bd9Sstevel@tonic-gate { \ 4777c478bd9Sstevel@tonic-gate ASSERT((&(c))->lmc_scope == LGRP_SRCH_LOCAL); \ 4787c478bd9Sstevel@tonic-gate (&(c))->lmc_scope = LGRP_SRCH_HIER; \ 4797c478bd9Sstevel@tonic-gate } 4807c478bd9Sstevel@tonic-gate 4817c478bd9Sstevel@tonic-gate /* 4827c478bd9Sstevel@tonic-gate * Macro to see whether memory allocation policy can be reapplied 4837c478bd9Sstevel@tonic-gate */ 4847c478bd9Sstevel@tonic-gate #define LGRP_MEM_POLICY_REAPPLICABLE(p) \ 4857c478bd9Sstevel@tonic-gate (p == LGRP_MEM_POLICY_NEXT) 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gate /* 4887c478bd9Sstevel@tonic-gate * Return true if lgrp has CPU resources in the cpupart 4897c478bd9Sstevel@tonic-gate */ 4907c478bd9Sstevel@tonic-gate #define LGRP_CPUS_IN_PART(lgrpid, cpupart) \ 4917c478bd9Sstevel@tonic-gate (cpupart->cp_lgrploads[lgrpid].lpl_ncpu > 0) 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate extern int lgrp_alloc_max; 4947c478bd9Sstevel@tonic-gate extern lgrp_t *lgrp_table[NLGRPS_MAX]; /* indexed by lgrp_id */ 4957c478bd9Sstevel@tonic-gate extern int nlgrps; /* number of lgroups in machine */ 4967c478bd9Sstevel@tonic-gate extern int nlgrpsmax; /* max number of lgroups on platform */ 4977c478bd9Sstevel@tonic-gate extern lgrp_gen_t lgrp_gen; /* generation of lgroup hierarchy */ 4987c478bd9Sstevel@tonic-gate extern int lgrp_initialized; /* single-CPU initialization done */ 4997c478bd9Sstevel@tonic-gate extern int lgrp_topo_initialized; /* lgrp topology constructed */ 5007c478bd9Sstevel@tonic-gate extern lgrp_t *lgrp_root; /* root lgroup */ 5017c478bd9Sstevel@tonic-gate extern unsigned int lgrp_topo_levels; 5027c478bd9Sstevel@tonic-gate extern lpl_t *lpl_bootstrap; /* bootstrap lpl for non-active CPUs */ 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gate 5057c478bd9Sstevel@tonic-gate /* generic interfaces */ 5067c478bd9Sstevel@tonic-gate 5077c478bd9Sstevel@tonic-gate /* 5087c478bd9Sstevel@tonic-gate * lgroup management 5097c478bd9Sstevel@tonic-gate */ 5107c478bd9Sstevel@tonic-gate int lgrp_optimizations(void); 5117c478bd9Sstevel@tonic-gate void lgrp_init(void); 5127c478bd9Sstevel@tonic-gate void lgrp_setup(void); 5137c478bd9Sstevel@tonic-gate lgrp_t *lgrp_create(void); 5147c478bd9Sstevel@tonic-gate void lgrp_destroy(lgrp_t *); 5157c478bd9Sstevel@tonic-gate void lgrp_config(lgrp_config_flag_t, uintptr_t, uintptr_t); 5167c478bd9Sstevel@tonic-gate lgrp_t *lgrp_hand_to_lgrp(lgrp_handle_t); 5177c478bd9Sstevel@tonic-gate 5187c478bd9Sstevel@tonic-gate /* 5197c478bd9Sstevel@tonic-gate * lgroup stats 5207c478bd9Sstevel@tonic-gate */ 5217c478bd9Sstevel@tonic-gate void lgrp_kstat_create(struct cpu *); 5227c478bd9Sstevel@tonic-gate void lgrp_kstat_destroy(struct cpu *); 5237c478bd9Sstevel@tonic-gate void lgrp_stat_add(lgrp_id_t, lgrp_stat_t, int64_t); 5247c478bd9Sstevel@tonic-gate int64_t lgrp_stat_read(lgrp_id_t, lgrp_stat_t); 5257c478bd9Sstevel@tonic-gate 5267c478bd9Sstevel@tonic-gate /* 5277c478bd9Sstevel@tonic-gate * lgroup memory 5287c478bd9Sstevel@tonic-gate */ 5297c478bd9Sstevel@tonic-gate lgrp_mem_policy_t lgrp_madv_to_policy(uchar_t, size_t, int); 5307c478bd9Sstevel@tonic-gate pgcnt_t lgrp_mem_size(lgrp_id_t, lgrp_mem_query_t); 5317c478bd9Sstevel@tonic-gate lgrp_t *lgrp_mem_choose(struct seg *, caddr_t, size_t); 5327c478bd9Sstevel@tonic-gate int lgrp_memnode_choose(lgrp_mnode_cookie_t *); 5337c478bd9Sstevel@tonic-gate lgrp_mem_policy_t lgrp_mem_policy_default(size_t, int); 5347c478bd9Sstevel@tonic-gate int lgrp_mnode_update(klgrpset_t, klgrpset_t *); 5357c478bd9Sstevel@tonic-gate lgrp_t *lgrp_pfn_to_lgrp(pfn_t); 5367c478bd9Sstevel@tonic-gate lgrp_t *lgrp_phys_to_lgrp(u_longlong_t); /* used by numat driver */ 5377c478bd9Sstevel@tonic-gate int lgrp_privm_policy_set(lgrp_mem_policy_t, lgrp_mem_policy_info_t *, 5387c478bd9Sstevel@tonic-gate size_t); 5397c478bd9Sstevel@tonic-gate void lgrp_shm_policy_init(struct anon_map *, vnode_t *); 5407c478bd9Sstevel@tonic-gate void lgrp_shm_policy_fini(struct anon_map *, vnode_t *); 5417c478bd9Sstevel@tonic-gate lgrp_mem_policy_info_t *lgrp_shm_policy_get(struct anon_map *, ulong_t, 5427c478bd9Sstevel@tonic-gate vnode_t *, u_offset_t); 5437c478bd9Sstevel@tonic-gate int lgrp_shm_policy_set(lgrp_mem_policy_t, struct anon_map *, ulong_t, 5447c478bd9Sstevel@tonic-gate vnode_t *, u_offset_t, size_t); 5457c478bd9Sstevel@tonic-gate 5467c478bd9Sstevel@tonic-gate /* 5477c478bd9Sstevel@tonic-gate * Used by numat driver 5487c478bd9Sstevel@tonic-gate */ 5497c478bd9Sstevel@tonic-gate int lgrp_query_cpu(processorid_t, lgrp_id_t *); 5507c478bd9Sstevel@tonic-gate int lgrp_query_load(processorid_t, lgrp_load_t *); 5517c478bd9Sstevel@tonic-gate 5527c478bd9Sstevel@tonic-gate /* 5537c478bd9Sstevel@tonic-gate * lgroup thread placement 5547c478bd9Sstevel@tonic-gate */ 55503400a71Sjjc lpl_t *lgrp_affinity_best(kthread_t *, struct cpupart *, lgrp_id_t, 55603400a71Sjjc boolean_t); 5577c478bd9Sstevel@tonic-gate void lgrp_affinity_init(lgrp_affinity_t **); 5587c478bd9Sstevel@tonic-gate void lgrp_affinity_free(lgrp_affinity_t **); 5597c478bd9Sstevel@tonic-gate lpl_t *lgrp_choose(kthread_t *t, struct cpupart *); 5607c478bd9Sstevel@tonic-gate lgrp_t *lgrp_home_lgrp(void); 5617c478bd9Sstevel@tonic-gate lgrp_id_t lgrp_home_id(kthread_t *); 5627c478bd9Sstevel@tonic-gate void lgrp_loadavg(lpl_t *, uint_t, int); 5637c478bd9Sstevel@tonic-gate void lgrp_move_thread(kthread_t *, lpl_t *, int); 5642cb27123Saguzovsk uint64_t lgrp_get_trthr_migrations(void); 5652cb27123Saguzovsk void lgrp_update_trthr_migrations(uint64_t); 5667c478bd9Sstevel@tonic-gate 5677c478bd9Sstevel@tonic-gate /* 5687c478bd9Sstevel@tonic-gate * lgroup topology 5697c478bd9Sstevel@tonic-gate */ 5707c478bd9Sstevel@tonic-gate int lgrp_leaf_add(lgrp_t *, lgrp_t **, int, klgrpset_t *); 5717c478bd9Sstevel@tonic-gate int lgrp_leaf_delete(lgrp_t *, lgrp_t **, int, klgrpset_t *); 5727c478bd9Sstevel@tonic-gate int lgrp_rsets_empty(klgrpset_t *); 5737c478bd9Sstevel@tonic-gate int lgrp_rsets_member(klgrpset_t *, lgrp_id_t); 5747c478bd9Sstevel@tonic-gate int lgrp_topo_flatten(int, lgrp_t **, int, klgrpset_t *); 5757c478bd9Sstevel@tonic-gate int lgrp_topo_ht_limit(void); 5767c478bd9Sstevel@tonic-gate int lgrp_topo_ht_limit_default(void); 5777c478bd9Sstevel@tonic-gate int lgrp_topo_ht_limit_set(int); 5787c478bd9Sstevel@tonic-gate int lgrp_topo_update(lgrp_t **, int, klgrpset_t *); 5797c478bd9Sstevel@tonic-gate 5807c478bd9Sstevel@tonic-gate /* 5817c478bd9Sstevel@tonic-gate * lpl topology 5827c478bd9Sstevel@tonic-gate */ 5837c478bd9Sstevel@tonic-gate void lpl_topo_bootstrap(lpl_t *, int); 5847c478bd9Sstevel@tonic-gate int lpl_topo_flatten(int); 5857c478bd9Sstevel@tonic-gate int lpl_topo_verify(struct cpupart *); 5867c478bd9Sstevel@tonic-gate 5877c478bd9Sstevel@tonic-gate 5887c478bd9Sstevel@tonic-gate /* platform interfaces */ 5897c478bd9Sstevel@tonic-gate void lgrp_plat_init(void); 5907c478bd9Sstevel@tonic-gate void lgrp_plat_main_init(void); 5917c478bd9Sstevel@tonic-gate lgrp_t *lgrp_plat_alloc(lgrp_id_t lgrpid); 5927c478bd9Sstevel@tonic-gate void lgrp_plat_config(lgrp_config_flag_t, uintptr_t); 5937c478bd9Sstevel@tonic-gate lgrp_handle_t lgrp_plat_cpu_to_hand(processorid_t); 5947c478bd9Sstevel@tonic-gate lgrp_handle_t lgrp_plat_pfn_to_hand(pfn_t); 5957c478bd9Sstevel@tonic-gate int lgrp_plat_max_lgrps(void); 5967c478bd9Sstevel@tonic-gate pgcnt_t lgrp_plat_mem_size(lgrp_handle_t, lgrp_mem_query_t); 5977c478bd9Sstevel@tonic-gate int lgrp_plat_latency(lgrp_handle_t, lgrp_handle_t); 5987c478bd9Sstevel@tonic-gate lgrp_handle_t lgrp_plat_root_hand(void); 5997c478bd9Sstevel@tonic-gate void lgrp_plat_probe(void); 6007c478bd9Sstevel@tonic-gate 601*ce8eb11aSdp78419 extern uint32_t lgrp_expand_proc_thresh; 602*ce8eb11aSdp78419 extern uint32_t lgrp_expand_proc_diff; 603*ce8eb11aSdp78419 extern pgcnt_t lgrp_mem_free_thresh; 604*ce8eb11aSdp78419 extern uint32_t lgrp_loadavg_tolerance; 605*ce8eb11aSdp78419 extern uint32_t lgrp_loadavg_max_effect; 606*ce8eb11aSdp78419 extern uint32_t lgrp_load_thresh; 607*ce8eb11aSdp78419 extern lgrp_mem_policy_t lgrp_mem_policy_root; 608*ce8eb11aSdp78419 extern int tsb_lgrp_affinity; 609*ce8eb11aSdp78419 6107c478bd9Sstevel@tonic-gate #endif /* _KERNEL && _KMEMUSER */ 6117c478bd9Sstevel@tonic-gate 6127c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6137c478bd9Sstevel@tonic-gate } 6147c478bd9Sstevel@tonic-gate #endif 6157c478bd9Sstevel@tonic-gate 6167c478bd9Sstevel@tonic-gate #endif /* _LGRP_H */ 617