|
|
1.1 root 1: .TH LNODE 5 SHARE
2: .SH NAME
3: lnode \- kernel user shares structure
4: .SH SYNOPSIS
5: .B "#include <sys/lnode.h>"
6: .SH DESCRIPTION
7: The kernel
8: .I lnode
9: structure is used to maintain per-user shares while a user has processes running.
10: .I Lnodes
11: are installed by
12: .IR login (8)
13: via the
14: .IR limits (2)
15: system call when a new user logs into the system.
16: .I Dead
17: lnodes are removed by
18: .IR sharer (8)
19: when the last process for a user exits.
20: The layout as given in the include file is:
21: .PP
22: .nf
23: .ift .ta 1.1i 1.9i
24: .ifn .ta 24n 35n
25: /*
26: * Structure for active shares
27: */
28:
29: typedef short uid_t;
30:
31: .ift .ta .3i 1.1i 1.9i
32: .ifn .ta 2n +10n +13n
33: struct lnode
34: {
35: uid_t l_uid; /* real uid for owner of this node */
36: u_short l_flags; /* (see below) */
37: u_short l_shares; /* allocated shares */
38: uid_t l_group; /* uid for this node's scheduling group */
39: float l_usage; /* decaying accumulated costs */
40: float l_charge; /* long term accumulated costs */
41: };
42:
43: /*
44: * Meaning of bits in l_flags
45: */
46:
47: .ift .ta .6i 1.8i 2.4i
48: .ifn .ta +8n +11n +6n
49: #define \s-1ACTIVELNODE\s0 001 /* this lnode is on active list */
50: #define \s-1LASTREF\s0 002 /* set for L_DEADLIM if last reference to this lnode */
51: #define \s-1DEADGROUP\s0 004 /* group account is dead */
52: #define \s-1CHNGDLIMITS\s0 020 /* this lnode's limits have changed */
53: #define \s-1NOTSHARED\s0 040 /* this lnode does not get a share of the m/c */
54: .DT
55: .fi
56: .PP
57: .I Lnodes
58: are grouped together in a tree.
59: At any level in the tree,
60: the share of resources allocated to an individual lnode is that
61: proportion of the group's resources
62: represented by the ratio of the lnode's shares
63: to the total shares of all the lnodes in the group.
64: The
65: .I l_group
66: field represents the
67: .I uid
68: of the group leader's lnode.
69: The top of the tree is represented by
70: .IR root 's
71: lnode, which is initialised at system boot time.
72: .PP
73: The
74: .SM LASTREF
75: bit in
76: .I l_flags
77: is set for the
78: .SM L_DEADLIM
79: request to the
80: .IR limits (2)
81: system call if the last process referencing the
82: .I lnode
83: has exited.
84: The
85: .SM DEADGROUP
86: bit is set if this
87: .I lnode
88: was the last one referencing it's group.
89: Dead groups are collected via the
90: .SM L_DEADGROUP
91: request to the
92: .IR limits (2)
93: system call.
94: .PP
95: The
96: .I l_charge
97: field is the long term accumulated charge for consumption of resources.
98: For group leaders, it represents the charge for the whole group.
99: The
100: .I l_usage
101: field is a number representing recent usage of resources,
102: and is used by the scheduler to determine current share of resources.
103: .SS kern_lnode
104: Each user's
105: .I lnode
106: is embedded in a larger structure to hold temporary values for use
107: by the scheduler, known as a
108: .IR kern_lnode .
109: The layout as given in the include file is:
110: .PP
111: .nf
112: .ift .ta 1.9i
113: .ifn .ta 28n
114: /*
115: * Kernel user share structure
116: */
117:
118: typedef struct kern_lnode * KL_p;
119:
120: .ift .ta .3i 1.1i 1.9i
121: .ifn .ta 2n +13n +13n
122: struct kern_lnode
123: {
124: KL_p kl_next; /* next in active list */
125: KL_p kl_prev; /* prev in active list */
126: KL_p kl_parent; /* group parent */
127: KL_p kl_gnext; /* next in parent's group */
128: KL_p kl_ghead; /* start of this group */
129: struct lnode kl; /* user parameters (as above) */
130: float kl_gshares; /* total shares for this group */
131: float kl_eshare; /* effective share for this group */
132: float kl_norms; /* share**2 for this lnode */
133: float kl_usage; /* kl.l_usage / kl_norms */
134: float kl_rate; /* active process rate for this lnode */
135: float kl_temp; /* temporary for scheduler */
136: float kl_spare; /* <spare> */
137: u_long kl_cost; /* cost accumulating in current period */
138: u_long kl_muse; /* memory pages used */
139: u_short kl_refcount; /* processes attached to this lnode */
140: u_short kl_children; /* lnodes attached to this lnode */
141: };
142: .DT
143: .fi
144: .PP
145: Every process has a pointer to its owner's
146: .I kern_lnode
147: called
148: .I p_lnode.
149: Every time a process incurs a clock tick,
150: the value
151: .I p_lnode\->kl_usage
152: multipied by
153: .I p_lnode\->kl_rate
154: is added to its scheduling priority in
155: .IR p_sharepri .
156: .I p_sharepri
157: is decayed by the clock by an amount depending on the process's
158: .I p_nice
159: value \(em the ``nicer'' the process, the slower the decay.
160: This value is copied into the low-level scheduler's priority in
161: .I p_pri
162: whenever the process is run in user space.
163: .SH "SEE ALSO"
164: limits(2),
165: share(5),
166: sharer(8).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.