Lines Matching defs:pg
38 #include <sys/pg.h>
63 * (LOGICAL or PHYSICAL), a pointer to a pg may be recast to a "view" of that
149 #define PG_FREE(pg) \
150 ((pg)->pg_class->pgc_ops->free ? \
151 (pg)->pg_class->pgc_ops->free(pg) : \
152 pg_classes[pg_default_cid].pgc_ops->free(pg)) \
158 #define PG_POLICY_NAME(pg) \
159 ((pg)->pg_class->pgc_ops->policy_name ? \
160 (pg)->pg_class->pgc_ops->policy_name(pg) : NULL) \
165 #define PG_CPU_BELONGS(pg, cp) \
166 ((pg)->pg_class->pgc_ops->cpu_belongs ? \
167 (pg)->pg_class->pgc_ops->cpu_belongs(pg, cp) : 0) \
332 * Try to find an existing pg in set in which to place cp.
333 * Returns the pg if found, and NULL otherwise.
340 pg_t *pg;
344 while ((pg = group_iterate(set, &i)) != NULL) {
348 if (PG_CPU_BELONGS(pg, cp))
349 return (pg);
362 pg_t *pg = itr->pg;
364 cpu = group_iterate(&pg->pg_cpus, &itr->position);
372 pg_cpu_find(pg_t *pg, cpu_t *cp)
374 if (group_find(&pg->pg_cpus, cp) == (uint_t)-1)
384 pg_callback_set_defaults(pg_t *pg)
386 bcopy(&pg_cb_ops_default, &pg->pg_cb, sizeof (struct pg_cb_ops));
396 pg_t *pg;
404 pg = PG_ALLOC(cid);
405 pg->pg_class = &pg_classes[cid];
406 pg->pg_relation = pg->pg_class->pgc_relation;
409 * Find the next free sequential pg id
417 pg->pg_id = id;
418 bitset_add(&pg_id_set, pg->pg_id);
423 group_create(&pg->pg_cpus);
428 pg_callback_set_defaults(pg);
430 return (pg);
438 pg_destroy(pg_t *pg)
442 group_destroy(&pg->pg_cpus);
447 if (pg_id_next > pg->pg_id)
448 pg_id_next = pg->pg_id;
449 bitset_del(&pg_id_set, pg->pg_id);
454 PG_FREE(pg);
458 * Add the CPU "cp" to processor group "pg"
462 pg_cpu_add(pg_t *pg, cpu_t *cp, cpu_pg_t *cpu_pg)
469 err = group_add(&pg->pg_cpus, cp, GRP_RESIZE);
480 err = group_add(&cpu_pg->pgs, pg, GRP_RESIZE);
485 * Remove "cp" from "pg".
489 pg_cpu_delete(pg_t *pg, cpu_t *cp, cpu_pg_t *cpu_pg)
496 err = group_remove(&pg->pg_cpus, cp, GRP_RESIZE);
507 err = group_remove(&cpu_pg->pgs, pg, GRP_RESIZE);
561 * Allocate and size the per CPU pg data
736 pg_policy_name(pg_t *pg)
739 if ((str = PG_POLICY_NAME(pg)) != NULL)
746 * Provide the specified CPU a bootstrap pg
776 pg_free_default(struct pg *pg)
778 kmem_free(pg, sizeof (pg_t));
799 pg_t *pg;
804 pg = GROUP_ACCESS(grp, i);
805 pg->pg_cb.thread_swtch(pg, cp, now, old, new);
820 pg_t *pg;
825 pg = GROUP_ACCESS(grp, i);
826 pg->pg_cb.thread_remain(pg, cp, t);