Skip to content

Commit

Permalink
Merge pull request #851 from robertbaldyga/core-stat-fix-inv-waiter
Browse files Browse the repository at this point in the history
Decrement core stats only if the cache line mapping is cleaned
  • Loading branch information
robertbaldyga authored Feb 6, 2025
2 parents be068df + 3959f58 commit c200c24
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/utils/utils_cache_line.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand All @@ -11,27 +12,25 @@ static void __set_cache_line_invalid(struct ocf_cache *cache, uint8_t start_bit,
ocf_core_id_t core_id, ocf_part_id_t part_id)
{
ocf_core_t core;
bool is_valid;
bool is_valid, changed;

ENV_BUG_ON(core_id >= OCF_CORE_MAX);
core = ocf_cache_get_core(cache, core_id);

if (metadata_clear_valid_sec_changed(cache, line, start_bit, end_bit,
&is_valid)) {
/*
* Update the number of cached data for that core object
*/
env_atomic_dec(&core->runtime_meta->cached_clines);
env_atomic_dec(&core->runtime_meta->
part_counters[part_id].cached_clines);
}
changed = metadata_clear_valid_sec_changed(cache, line,
start_bit, end_bit, &is_valid);

/* If we have waiters, do not remove cache line
* for this cache line which will use one, clear
* only valid bits
*/
if (!is_valid && !ocf_cache_line_are_waiters(
ocf_cache_line_concurrency(cache), line)) {
if (changed) {
env_atomic_dec(&core->runtime_meta->cached_clines);
env_atomic_dec(&core->runtime_meta->
part_counters[part_id].cached_clines);
}
ocf_lru_rm_cline(cache, line);
ocf_metadata_remove_cache_line(cache, line);
}
Expand Down

0 comments on commit c200c24

Please sign in to comment.