Skip to content

Commit

Permalink
Add fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
porcuquine committed Oct 8, 2020
1 parent fb5172f commit 694109f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions storage-proofs/porep/src/stacked/vanilla/cores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn checkout_core_group() -> Option<MutexGuard<'static, CoreGroup>> {
}

pub struct Cleanup {
tid: libc::pthread_t,
prior_state: Option<hwloc::Bitmap>,
}

Expand All @@ -51,9 +52,8 @@ impl Drop for Cleanup {
match self.prior_state.take() {
Some(prior) => {
let child_topo = &TOPOLOGY;
let tid = get_thread_id();
let mut locked_topo = child_topo.lock().unwrap();
let _ = locked_topo.set_cpubind_for_thread(tid, prior, CPUBIND_THREAD);
let _ = locked_topo.set_cpubind_for_thread(self.tid, prior, CPUBIND_THREAD);
}
None => (),
}
Expand Down Expand Up @@ -91,6 +91,7 @@ pub fn bind_core(core_index: CoreIndex) -> Result<Cleanup> {
}

Ok(Cleanup {
tid,
prior_state: before,
})
}
Expand Down
10 changes: 5 additions & 5 deletions storage-proofs/porep/src/stacked/vanilla/create_label/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@ pub fn create_labels_for_decoding<Tree: 'static + MerkleTreeTrait, T: AsRef<[u8]

let core_group = Arc::new(checkout_core_group());

if let Some(group) = &*core_group {
// When `_cleanup_handle` is dropped, the previous binding of thread will be restored.
let _cleanup_handle = (*core_group).as_ref().map(|group| {
// This could fail, but we will ignore the error if so.
// It will be logged as a warning by `bind_core`.
if let Some(&core_index) = group.get(0) {
let _ = bind_core(core_index);
}
};
debug!("binding core in main thread");
group.get(0).map(|core_index| bind_core(*core_index))
});

// NOTE: this means we currently keep 2x sector size around, to improve speed
let (parents_cache, mut layer_labels, mut exp_labels) = setup_create_label_memory(
Expand Down

0 comments on commit 694109f

Please sign in to comment.