Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrement core stats only if the cache line mapping is cleaned #851

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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