MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BackgroundWork

Method BackgroundWork

tensorflow/core/framework/experimental_pmem_allocator.cc:79–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void ExperimentalPMemAllocator::BackgroundWork() {
80 while (1) {
81 if (closing_) return;
82 usleep(bg_thread_interval_ * 1000000);
83 // Move cached list to pool
84 std::vector<void*> moving_list;
85 for (size_t i = 0; i < thread_cache_.size(); i++) {
86 auto& tc = thread_cache_[i];
87 moving_list.clear();
88 for (size_t b_size = 1; b_size < tc.freelists.size(); b_size++) {
89 moving_list.clear();
90 std::lock_guard<spin_lock> lg(tc.locks[b_size]);
91
92 if (tc.freelists[b_size].size() >= kMinMovableListSize) {
93 if (tc.freelists[b_size].size() >= kMinMovableListSize) {
94 moving_list.swap(tc.freelists[b_size]);
95 }
96 }
97 if (moving_list.size() > 0) {
98 pool_.MoveEntryList(moving_list, b_size);
99 }
100 }
101 }
102 }
103}
104
105ExperimentalPMemAllocator::ExperimentalPMemAllocator(
106 char* pmem, const std::string& pmem_file_name, uint64_t pmem_size,

Callers 1

Calls 4

MoveEntryListMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected