41 other constraints. Processor binding and processor sets can restrict
42 which lgroups a thread can run on, but do not change the lgroup
43 affinities.
44
45
46 Each thread can have an affinity for an lgroup in the system such that
47 the thread will tend to be scheduled to run on that lgroup and allocate
48 memory from there whenever possible. If the thread has affinity for
49 more than one lgroup, the operating system will try to run the thread
50 and allocate its memory on the lgroup for which it has the strongest
51 affinity, then the next strongest, and so on up through some small,
52 system-dependent number of these lgroup affinities. When multiple
53 lgroups have the same affinity, the order of preference among them is
54 unspecified and up to the operating system to choose. The lgroup with
55 the strongest affinity that the thread can run on is known as its "home
56 lgroup" (see lgrp_home(3LGRP)) and is usually the operating system's
57 first choice of where to run the thread and allocate its memory.
58
59
60 There are different levels of affinity that can be specified by a
61 thread for a particuliar lgroup. The levels of affinity are the
62 following from strongest to weakest:
63
64 LGRP_AFF_STRONG /* strong affinity */
65 LGRP_AFF_WEAK /* weak affinity */
66 LGRP_AFF_NONE /* no affinity */
67
68
69
70 The LGRP_AFF_STRONG affinity serves as a hint to the operating system
71 that the calling thread has a strong affinity for the given lgroup. If
72 this is the thread's home lgroup, the operating system will avoid
73 rehoming it to another lgroup if possible. However, dynamic
74 reconfiguration, processor offlining, processor binding, and processor
75 set binding and manipulation are examples of events that can cause the
76 operating system to change the thread's home lgroup for which it has a
77 strong affinity.
78
79
80 The LGRP_AFF_WEAK affinity is a hint to the operating system that the
81 calling thread has a weak affinity for the given lgroup. If a thread
82 has a weak affinity for its home lgroup, the operating system interpets
83 this to mean that thread does not mind whether it is rehomed, unlike
84 LGRP_AFF_STRONG. Load balancing, dynamic reconfiguration, processor
85 binding, or processor set binding and manipulation are examples of
86 events that can cause the operating system to change a thread's home
87 lgroup for which it has a weak affinity.
88
89
90 The LGRP_AFF_NONE affinity signifies no affinity and can be used to
91 remove a thread's affinity for a particuliar lgroup. Initially, each
92 thread has no affinity to any lgroup. If a thread has no lgroup
93 affinities set, the operating system chooses a home lgroup for the
94 thread with no affinity set.
95
96 RETURN VALUES
97 Upon successful completion, lgrp_affinity_get() returns the affinity
98 for the given lgroup.
99
100
101 Upon successful completion, lgrp_affinity_set() return 0.
102
103
104 Otherwise, both functions return -1 and set errno to indicate the
105 error.
106
107 ERRORS
108 The lgrp_affinity_get() and lgrp_affinity_set() functions will fail if:
109
110 EINVAL
111 The specified lgroup, affinity, or ID type is not valid.
|
41 other constraints. Processor binding and processor sets can restrict
42 which lgroups a thread can run on, but do not change the lgroup
43 affinities.
44
45
46 Each thread can have an affinity for an lgroup in the system such that
47 the thread will tend to be scheduled to run on that lgroup and allocate
48 memory from there whenever possible. If the thread has affinity for
49 more than one lgroup, the operating system will try to run the thread
50 and allocate its memory on the lgroup for which it has the strongest
51 affinity, then the next strongest, and so on up through some small,
52 system-dependent number of these lgroup affinities. When multiple
53 lgroups have the same affinity, the order of preference among them is
54 unspecified and up to the operating system to choose. The lgroup with
55 the strongest affinity that the thread can run on is known as its "home
56 lgroup" (see lgrp_home(3LGRP)) and is usually the operating system's
57 first choice of where to run the thread and allocate its memory.
58
59
60 There are different levels of affinity that can be specified by a
61 thread for a particular lgroup. The levels of affinity are the
62 following from strongest to weakest:
63
64 LGRP_AFF_STRONG /* strong affinity */
65 LGRP_AFF_WEAK /* weak affinity */
66 LGRP_AFF_NONE /* no affinity */
67
68
69
70 The LGRP_AFF_STRONG affinity serves as a hint to the operating system
71 that the calling thread has a strong affinity for the given lgroup. If
72 this is the thread's home lgroup, the operating system will avoid
73 rehoming it to another lgroup if possible. However, dynamic
74 reconfiguration, processor offlining, processor binding, and processor
75 set binding and manipulation are examples of events that can cause the
76 operating system to change the thread's home lgroup for which it has a
77 strong affinity.
78
79
80 The LGRP_AFF_WEAK affinity is a hint to the operating system that the
81 calling thread has a weak affinity for the given lgroup. If a thread
82 has a weak affinity for its home lgroup, the operating system interpets
83 this to mean that thread does not mind whether it is rehomed, unlike
84 LGRP_AFF_STRONG. Load balancing, dynamic reconfiguration, processor
85 binding, or processor set binding and manipulation are examples of
86 events that can cause the operating system to change a thread's home
87 lgroup for which it has a weak affinity.
88
89
90 The LGRP_AFF_NONE affinity signifies no affinity and can be used to
91 remove a thread's affinity for a particular lgroup. Initially, each
92 thread has no affinity to any lgroup. If a thread has no lgroup
93 affinities set, the operating system chooses a home lgroup for the
94 thread with no affinity set.
95
96 RETURN VALUES
97 Upon successful completion, lgrp_affinity_get() returns the affinity
98 for the given lgroup.
99
100
101 Upon successful completion, lgrp_affinity_set() return 0.
102
103
104 Otherwise, both functions return -1 and set errno to indicate the
105 error.
106
107 ERRORS
108 The lgrp_affinity_get() and lgrp_affinity_set() functions will fail if:
109
110 EINVAL
111 The specified lgroup, affinity, or ID type is not valid.
|