« lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/RDMA.pm
↑ Summary
lib/Mojo/IOLoop/ReadWriteProcess/CGroup/v2/Memory.pm »
| 1 | package Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Cpuset; | ||
| 2 | |||
| 3 | 15 | ▶ | use Mojo::Base -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 15 | ▶ | use constant { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | # list of CPUs in that cpuset | ||
| 8 | 15 | 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 | }; | |
| 44 | |||
| 45 | 0 | ▶ | has cgroup => sub { Mojo::IOLoop::ReadWriteProcess::CGroup::v1->new }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 46 | |||
| 47 | 1 | ▶ | sub cpus { shift->cgroup->_write(CPUS_INTERFACE, @_) } |
|
Subroutine
cpus: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 48 | 1 | ▶ | sub mems { shift->cgroup->_write(MEMS_INTERFACE, @_) } |
|
Subroutine
mems: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | |||
| 50 | 2 | ▶ | sub memory_pressure { |
|
Subroutine
memory_pressure: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 51 | 2 | shift->cgroup->_flag(MEMORY_PRESSURE_ENABLED_INTERFACE, @_); | |
| 52 | } | ||
| 53 | |||
| 54 | 2 | ▶ | sub sched_relax_domain_level { |
|
Subroutine
sched_relax_domain_level: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 55 | 2 | shift->cgroup->_flag(SCHED_RELAX_DOMAIN_LEVEL_INTERFACE, @_); | |
| 56 | } | ||
| 57 | |||
| 58 | 2 | ▶ | sub sched_load_balance { |
|
Subroutine
sched_load_balance: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 59 | 2 | shift->cgroup->_flag(SCHED_LOAD_BALANCE_INTERFACE, @_); | |
| 60 | } | ||
| 61 | 2 | ▶ | sub memory_spread_slab { shift->cgroup->_flag(MEM_SPREAD_SLAB_INTERFACE, @_) } |
|
Subroutine
memory_spread_slab: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 62 | 2 | ▶ | sub memory_spread_page { shift->cgroup->_flag(MEM_SPREAD_PAGE_INTERFACE, @_) } |
|
Subroutine
memory_spread_page: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 63 | 1 | ▶ | sub get_memory_pressure { shift->cgroup->_list(MEM_PRESSURE_INTERFACE) } |
|
Subroutine
get_memory_pressure: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 64 | 2 | ▶ | sub mem_hardwall { shift->cgroup->_flag(MEM_HARDWALL_INTERFACE, @_) } |
|
Subroutine
mem_hardwall: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 65 | 2 | ▶ | sub mem_exclusive { shift->cgroup->_flag(MEM_EXCLUSIVE_INTERFACE, @_) } |
|
Subroutine
mem_exclusive: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 66 | 2 | ▶ | sub cpu_exclusive { shift->cgroup->_flag(CPU_EXCLUSIVE_INTERFACE, @_) } |
|
Subroutine
cpu_exclusive: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 67 | 2 | ▶ | sub memory_migrate { shift->cgroup->_flag(MEMORY_MIGRATE_INTERFACE, @_) } |
|
Subroutine
memory_migrate: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 68 | |||
| 69 | 15 | 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<Mojo::IOLoop::ReadWriteProcess::CGroup::v1::Cpuset> inherits all methods from L<Mojo::Base> 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 E<lt>edigiacinto@suse.comE<gt> | ||
| 105 | |||
| 106 | =cut | ||