Skip to content

Commit

Permalink
Decrement core stats only if the cache line mapping is cleaned
Browse files Browse the repository at this point in the history
We skip cleaning the mapping and moving the cache line to the free list
in a situation when there are waiters on the cache line lock.
Refrain from decrementing core stats in that situation as well, and let
repart of the waiter request do the updates as needed.

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
  • Loading branch information
robertbaldyga committed Oct 14, 2024
1 parent 6ad1007 commit 47d5de7
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/utils/utils_cache_line.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,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 47d5de7

Please sign in to comment.