]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/include/seastar/core/smp_options.hh
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / seastar / include / seastar / core / smp_options.hh
1 /*
2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
6 *
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
16 * under the License.
17 */
18 /*
19 * Copyright 2022 ScyllaDB
20 */
21
22 #pragma once
23
24 #include <seastar/util/program-options.hh>
25
26 /// \file
27
28 namespace seastar {
29
30 enum class memory_allocator {
31 /// Seastar's own allocator, optimized for its shard-per core design.
32 /// Strongly recommended for most seastar apps.
33 seastar,
34 /// The standard allocator from libc.
35 /// Useful when writing seastar-based tool apps that want to
36 /// minimize their footprint on the system they run on.
37 standard,
38 };
39
40 /// Configuration for the multicore aspect of seastar.
41 struct smp_options : public program_options::option_group {
42 /// Number of threads (default: one per CPU).
43 program_options::value<unsigned> smp;
44 /// CPUs to use (in cpuset(7) format; default: all)).
45 program_options::value<resource::cpuset> cpuset;
46 /// Memory to use, in bytes (ex: 4G) (default: all).
47 program_options::value<std::string> memory;
48 /// Memory reserved to OS (if \ref memory not specified).
49 program_options::value<std::string> reserve_memory;
50 /// Path to accessible hugetlbfs mount (typically /dev/hugepages/something).
51 program_options::value<std::string> hugepages;
52 /// Lock all memory (prevents swapping).
53 program_options::value<bool> lock_memory;
54 /// Pin threads to their cpus (disable for overprovisioning).
55 ///
56 /// Default: \p true.
57 program_options::value<bool> thread_affinity;
58 /// \brief Number of IO queues.
59 ///
60 /// Each IO unit will be responsible for a fraction of the IO requests.
61 /// Defaults to the number of threads
62 /// \note Unused when seastar is compiled without \p HWLOC support.
63 program_options::value<unsigned> num_io_queues;
64 /// \brief Number of IO groups.
65 ///
66 /// Each IO group will be responsible for a fraction of the IO requests.
67 /// Defaults to the number of NUMA nodes
68 /// \note Unused when seastar is compiled without \p HWLOC support.
69 program_options::value<unsigned> num_io_groups;
70 /// Path to a YAML file describing the characteristics of the I/O Subsystem.
71 program_options::value<std::string> io_properties_file;
72 /// A YAML string describing the characteristics of the I/O Subsystem.
73 program_options::value<std::string> io_properties;
74 /// Enable mbind.
75 ///
76 /// Default: \p true.
77 program_options::value<bool> mbind;
78 /// Enable workaround for glibc/gcc c++ exception scalablity problem.
79 ///
80 /// Default: \p true.
81 /// \note Unused when seastar is compiled without the exception scaling support.
82 program_options::value<bool> enable_glibc_exception_scaling_workaround;
83 /// If some CPUs are found not to have any local NUMA nodes, allow assigning
84 /// them to remote ones.
85 /// \note Unused when seastar is compiled without \p HWLOC support.
86 program_options::value<bool> allow_cpus_in_remote_numa_nodes;
87
88 /// Memory allocator to use.
89 ///
90 /// The following options only have effect if the \ref memory_allocator::seastar is used:
91 /// * \ref smp_options::memory
92 /// * \ref smp_options::reserve_memory
93 /// * \ref smp_options::hugepages
94 /// * \ref smp_options::mbind
95 /// * \ref reactor_options::heapprof
96 /// * \ref reactor_options::abort_on_seastar_bad_alloc
97 /// * \ref reactor_options::dump_memory_diagnostics_on_alloc_failure_kind
98 seastar::memory_allocator memory_allocator = memory_allocator::seastar;
99
100 /// \cond internal
101 /// Additional memory reserved to OS (added to the default value or the value specified by \ref reserve_memory).
102 size_t reserve_additional_memory = 0;
103 /// \endcond
104 public:
105 smp_options(program_options::option_group* parent_group);
106 };
107
108 }