view usr/src/man/man3lgrp/lgrp_affinity_get.3lgrp @ 23918:f3c8f3a2a25c

13404 man page spelling errors Reviewed by: Ryan Zezeski <ryan@oxide.computer> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Richard Lowe <richlowe@richlowe.net>
author Peter Tribble <peter.tribble@gmail.com>
date Thu, 31 Dec 2020 10:47:42 +0000
parents 9c3aeee7089e
children
line wrap: on
line source

'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LGRP_AFFINITY_GET 3LGRP "December 28, 2020"
.SH NAME
lgrp_affinity_get, lgrp_affinity_set \- get or set lgroup affinity
.SH SYNOPSIS
.nf
cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-llgrp\fR [ \fIlibrary \&.\|.\|.\fR ]
#include <sys/lgrp_user.h>

\fBlgrp_affinity_t\fR \fBlgrp_affinity_get\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR,
     \fBlgrp_id_t\fR \fIlgrp\fR);
.fi

.LP
.nf
\fBint\fR \fBlgrp_affinity_set\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR, \fBlgrp_id_t\fR \fIlgrp\fR,
     \fBlgrp_affinity_t\fR \fIaffinity\fR);
.fi

.SH DESCRIPTION
The \fBlgrp_affinity_get()\fR function returns the affinity that the LWP or set
of LWPs specified by the \fIidtype\fR and \fIid\fR arguments have for the given
lgroup.
.sp
.LP
The \fBlgrp_affinity_set()\fR function sets the affinity that the LWP or set of
LWPs specified by \fIidtype\fR and \fIid\fR have for the given lgroup.  The
lgroup affinity can be set to \fBLGRP_AFF_STRONG\fR, \fBLGRP_AFF_WEAK\fR, or
\fBLGRP_AFF_NONE\fR.
.sp
.LP
If the \fIidtype\fR is \fBP_PID\fR, the affinity is retrieved for one of the
LWPs in the process or set for all the LWPs of the process with process ID
(PID) \fIid\fR. The affinity is retrieved or set for the LWP of the current
process with LWP ID \fIid\fR if \fIidtype\fR is \fBP_LWPID\fR.  If \fIid\fR is
\fBP_MYID\fR, then the current LWP or process is specified.
.sp
.LP
The operating system uses the lgroup affinities as advice on where to run a
thread and allocate its memory and factors this advice in with other
constraints.  Processor binding and processor sets can restrict which lgroups a
thread can run on, but do not change the lgroup affinities.
.sp
.LP
Each thread can have an affinity for an lgroup in the system such that the
thread will tend to be scheduled to run on that lgroup and allocate memory from
there whenever possible.  If the thread has affinity for more than one lgroup,
the operating system will try to run the thread and allocate its memory on the
lgroup for which it has the strongest affinity, then the next strongest, and so
on up through some small, system-dependent number of these lgroup affinities.
When multiple lgroups have the same affinity, the order of preference among
them is unspecified and up to the operating system to choose.  The lgroup with
the strongest affinity that the thread can run on is known as its "home lgroup"
(see \fBlgrp_home\fR(3LGRP)) and is usually the operating system's first choice
of where to run the thread and allocate its memory.
.sp
.LP
There are different levels of affinity that can be specified by a thread for a
particular lgroup.  The levels of affinity are the following from strongest to
weakest:
.sp
.in +2
.nf
LGRP_AFF_STRONG         /* strong affinity */
LGRP_AFF_WEAK           /* weak affinity */
LGRP_AFF_NONE           /* no affinity */
.fi
.in -2

.sp
.LP
The \fBLGRP_AFF_STRONG\fR affinity serves as a hint to the operating system
that the calling thread has a strong affinity for the given lgroup.  If this is
the thread's home lgroup, the operating system will avoid rehoming it to
another lgroup if possible.  However, dynamic reconfiguration, processor
offlining, processor binding, and processor set binding and manipulation are
examples of events that can cause the operating system to change the thread's
home lgroup for which it has a strong affinity.
.sp
.LP
The \fBLGRP_AFF_WEAK\fR affinity is a hint to the operating system that the
calling thread has a weak affinity for the given lgroup.  If a thread has a
weak affinity for its home lgroup, the operating system interprets this to mean
that thread does not mind whether it is rehomed, unlike \fBLGRP_AFF_STRONG\fR.
Load balancing, dynamic reconfiguration, processor binding, or processor set
binding and manipulation are examples of events that can cause the operating
system to change a thread's home lgroup for which it has a weak affinity.
.sp
.LP
The \fBLGRP_AFF_NONE\fR affinity signifies no affinity and can be used to
remove a thread's affinity for a particular lgroup.  Initially, each thread
has no affinity to any lgroup.  If a thread has no lgroup affinities set, the
operating system chooses a home lgroup for the thread with no affinity set.
.SH RETURN VALUES
Upon successful completion, \fBlgrp_affinity_get()\fR returns the affinity for
the given lgroup.
.sp
.LP
Upon successful completion, \fBlgrp_affinity_set()\fR return 0.
.sp
.LP
Otherwise, both functions return \(mi1 and set \fBerrno\fR to indicate the
error.
.SH ERRORS
The \fBlgrp_affinity_get()\fR and \fBlgrp_affinity_set()\fR functions will fail
if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The specified lgroup, affinity, or ID type is not valid.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
The effective user of the calling process does not have appropriate privileges,
and its real or effective user ID does not match the real or effective user ID
of one of the LWPs.
.RE

.sp
.ne 2
.na
\fB\fBESRCH\fR\fR
.ad
.RS 10n
The specified lgroup or LWP(s) was not found.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
\fBlgrp_home\fR(3LGRP), \fBliblgrp\fR(3LIB), \fBattributes\fR(5)