line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Cpuset; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
116
|
use Mojo::Base -base; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
101
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use constant { |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# list of CPUs in that cpuset |
8
|
15
|
|
|
|
|
13175
|
CPUS_INTERFACE => 'cpuset.cpus', |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# list of Memory Nodes in that cpuset |
11
|
|
|
|
|
|
|
MEMS_INTERFACE => 'cpuset.mems', |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# if set, move pages to cpusets nodes |
14
|
|
|
|
|
|
|
MEMORY_MIGRATE_INTERFACE => 'cpuset.memory_migrate', |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# is cpu placement exclusive? |
17
|
|
|
|
|
|
|
CPU_EXCLUSIVE_INTERFACE => 'cpuset.cpu_exclusive', |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# is memory placement exclusive? |
20
|
|
|
|
|
|
|
MEM_EXCLUSIVE_INTERFACE => 'cpuset.mem_exclusive', |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# is memory allocation hardwalled |
23
|
|
|
|
|
|
|
MEM_HARDWALL_INTERFACE => 'cpuset.mem_hardwall', |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# measure of how much paging pressure in cpuset |
26
|
|
|
|
|
|
|
MEM_PRESSURE_INTERFACE => 'cpuset.memory_pressure', |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# if set, spread page cache evenly on allowed nodes |
29
|
|
|
|
|
|
|
MEM_SPREAD_PAGE_INTERFACE => 'cpuset.memory_spread_page', |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# if set, spread slab cache evenly on allowed nodes |
32
|
|
|
|
|
|
|
MEM_SPREAD_SLAB_INTERFACE => 'cpuset.memory_spread_slab', |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# if set, load balance within CPUs on that cpuset |
35
|
|
|
|
|
|
|
SCHED_LOAD_BALANCE_INTERFACE => 'cpuset.sched_load_balance', |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# the searching range when migrating tasks |
38
|
|
|
|
|
|
|
SCHED_RELAX_DOMAIN_LEVEL_INTERFACE => 'cpuset.sched_relax_domain_level', |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# In addition, only the root cpuset has the following - compute memory_pressure? |
41
|
|
|
|
|
|
|
MEMORY_PRESSURE_ENABLED_INTERFACE => 'cpuset.memory_pressure_enabled', |
42
|
|
|
|
|
|
|
|
43
|
15
|
|
|
15
|
|
2811
|
}; |
|
15
|
|
|
|
|
29
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v1->new }; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
0
|
775
|
sub cpus { shift->cgroup->_write(CPUS_INTERFACE, @_) } |
48
|
1
|
|
|
1
|
0
|
11
|
sub mems { shift->cgroup->_write(MEMS_INTERFACE, @_) } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub memory_pressure { |
51
|
2
|
|
|
2
|
0
|
1571
|
shift->cgroup->_flag(MEMORY_PRESSURE_ENABLED_INTERFACE, @_); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub sched_relax_domain_level { |
55
|
2
|
|
|
2
|
0
|
1515
|
shift->cgroup->_flag(SCHED_RELAX_DOMAIN_LEVEL_INTERFACE, @_); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub sched_load_balance { |
59
|
2
|
|
|
2
|
0
|
1520
|
shift->cgroup->_flag(SCHED_LOAD_BALANCE_INTERFACE, @_); |
60
|
|
|
|
|
|
|
} |
61
|
2
|
|
|
2
|
0
|
1534
|
sub memory_spread_slab { shift->cgroup->_flag(MEM_SPREAD_SLAB_INTERFACE, @_) } |
62
|
2
|
|
|
2
|
0
|
1516
|
sub memory_spread_page { shift->cgroup->_flag(MEM_SPREAD_PAGE_INTERFACE, @_) } |
63
|
1
|
|
|
1
|
0
|
189
|
sub get_memory_pressure { shift->cgroup->_list(MEM_PRESSURE_INTERFACE) } |
64
|
2
|
|
|
2
|
0
|
1605
|
sub mem_hardwall { shift->cgroup->_flag(MEM_HARDWALL_INTERFACE, @_) } |
65
|
2
|
|
|
2
|
0
|
1542
|
sub mem_exclusive { shift->cgroup->_flag(MEM_EXCLUSIVE_INTERFACE, @_) } |
66
|
2
|
|
|
2
|
0
|
1624
|
sub cpu_exclusive { shift->cgroup->_flag(CPU_EXCLUSIVE_INTERFACE, @_) } |
67
|
2
|
|
|
2
|
0
|
771
|
sub memory_migrate { shift->cgroup->_flag(MEMORY_MIGRATE_INTERFACE, @_) } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding utf-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Cpuset - CGroups v1 Cpuset Controller |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 SYNOPSIS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
use Mojo::IOLoop::ReadWriteProcess::CGroup::v1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $cgroup = Mojo::IOLoop::ReadWriteProcess::CGroup::v1->new( name => "test" ); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$cgroup->cpuset->current; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This module uses features that are only available on Linux, |
88
|
|
|
|
|
|
|
and requires cgroups and capability for unshare syscalls to achieve pid isolation. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L inherits all methods from L and implements |
93
|
|
|
|
|
|
|
the following new ones. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright (C) Ettore Di Giacinto. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
100
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Ettore Di Giacinto Eedigiacinto@suse.comE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |