@@ -2,14 +2,15 @@ use std::convert::TryInto;
2
2
use std:: sync:: { Mutex , MutexGuard } ;
3
3
4
4
use anyhow:: { format_err, Result } ;
5
- use hwloc:: { Bitmap , ObjectType , Topology , TopologyObject , CPUBIND_THREAD } ;
5
+ use hwloc:: { Bitmap , CpuBindFlags , ObjectType , Topology , TopologyObject } ;
6
6
use lazy_static:: lazy_static;
7
7
use log:: { debug, warn} ;
8
8
use storage_proofs_core:: settings:: SETTINGS ;
9
9
10
10
type CoreUnit = Vec < CoreIndex > ;
11
11
lazy_static ! {
12
- pub static ref TOPOLOGY : Mutex <Topology > = Mutex :: new( Topology :: new( ) ) ;
12
+ pub static ref TOPOLOGY : Mutex <Topology > =
13
+ Mutex :: new( Topology :: new( ) . expect( "failed to initialize and load cpu topology" ) ) ;
13
14
pub static ref CORE_GROUPS : Option <Vec <Mutex <CoreUnit >>> = {
14
15
let num_producers = & SETTINGS . multicore_sdr_producers;
15
16
let cores_per_unit = num_producers + 1 ;
@@ -69,7 +70,8 @@ impl Drop for Cleanup {
69
70
if let Some ( prior) = self . prior_state . take ( ) {
70
71
let child_topo = & TOPOLOGY ;
71
72
let mut locked_topo = child_topo. lock ( ) . expect ( "poisded lock" ) ;
72
- let _ = locked_topo. set_cpubind_for_thread ( self . tid , prior, CPUBIND_THREAD ) ;
73
+ let _ =
74
+ locked_topo. set_cpubind_for_thread ( self . tid , prior, CpuBindFlags :: CPUBIND_THREAD ) ;
73
75
}
74
76
}
75
77
}
@@ -82,7 +84,7 @@ pub fn bind_core(core_index: CoreIndex) -> Result<Cleanup> {
82
84
. map_err ( |err| format_err ! ( "failed to get core at index {}: {:?}" , core_index. 0 , err) ) ?;
83
85
84
86
let cpuset = core
85
- . allowed_cpuset ( )
87
+ . cpuset ( )
86
88
. ok_or_else ( || format_err ! ( "no allowed cpuset for core at index {}" , core_index. 0 , ) ) ?;
87
89
debug ! ( "allowed cpuset: {:?}" , cpuset) ;
88
90
let mut bind_to = cpuset;
@@ -91,12 +93,12 @@ pub fn bind_core(core_index: CoreIndex) -> Result<Cleanup> {
91
93
bind_to. singlify ( ) ;
92
94
93
95
// Thread binding before explicit set.
94
- let before = locked_topo. get_cpubind_for_thread ( tid, CPUBIND_THREAD ) ;
96
+ let before = locked_topo. get_cpubind_for_thread ( tid, CpuBindFlags :: CPUBIND_THREAD ) ;
95
97
96
98
debug ! ( "binding to {:?}" , bind_to) ;
97
99
// Set the binding.
98
100
let result = locked_topo
99
- . set_cpubind_for_thread ( tid, bind_to, CPUBIND_THREAD )
101
+ . set_cpubind_for_thread ( tid, bind_to, CpuBindFlags :: CPUBIND_THREAD )
100
102
. map_err ( |err| format_err ! ( "failed to bind CPU: {:?}" , err) ) ;
101
103
102
104
if result. is_err ( ) {
@@ -239,7 +241,7 @@ fn core_units(cores_per_unit: usize) -> Option<Vec<Mutex<CoreUnit>>> {
239
241
. get_cpubind ( hwloc:: CpuBindFlags :: empty ( ) )
240
242
. unwrap_or_else ( || {
241
243
topo. object_at_root ( )
242
- . allowed_cpuset ( )
244
+ . cpuset ( )
243
245
. unwrap_or_else ( hwloc:: CpuSet :: full)
244
246
} ) ;
245
247
0 commit comments