Shuffle entries within freelists
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
53f6cffe7f
commit
6a665ea6b1
@ -7,6 +7,7 @@
|
||||
#include "ocf_lru.h"
|
||||
#include "utils/utils_cleaner.h"
|
||||
#include "utils/utils_cache_line.h"
|
||||
#include "utils/utils_generator.h"
|
||||
#include "utils/utils_parallelize.h"
|
||||
#include "concurrency/ocf_concurrency.h"
|
||||
#include "mngt/ocf_mngt_common.h"
|
||||
@ -883,18 +884,30 @@ static int ocf_lru_populate_handle(ocf_parallelize_t parallelize,
|
||||
ocf_cache_t cache = context->cache;
|
||||
ocf_cache_line_t cnt, cline;
|
||||
ocf_cache_line_t entries = ocf_metadata_collision_table_entries(cache);
|
||||
struct ocf_generator_bisect_state generator;
|
||||
struct ocf_lru_list *list;
|
||||
unsigned lru_list = shard_id;
|
||||
unsigned step = 0;
|
||||
uint32_t portion, offset;
|
||||
uint32_t i, idx;
|
||||
|
||||
cnt = 0;
|
||||
for (cline = shard_id; cline < entries; cline += shards_cnt) {
|
||||
OCF_COND_RESCHED_DEFAULT(step);
|
||||
|
||||
ocf_metadata_set_partition_id(cache, cline, PARTITION_FREELIST);
|
||||
portion = DIV_ROUND_UP((uint64_t)entries, shards_cnt);
|
||||
offset = shard_id * portion / shards_cnt;
|
||||
ocf_generator_bisect_init(&generator, portion, offset);
|
||||
|
||||
list = ocf_lru_get_list(&cache->free, lru_list, true);
|
||||
|
||||
cnt = 0;
|
||||
for (i = 0; i < portion; i++) {
|
||||
OCF_COND_RESCHED_DEFAULT(step);
|
||||
|
||||
idx = ocf_generator_bisect_next(&generator);
|
||||
cline = idx * shards_cnt + shard_id;
|
||||
if (cline >= entries)
|
||||
continue;
|
||||
|
||||
ocf_metadata_set_partition_id(cache, cline, PARTITION_FREELIST);
|
||||
|
||||
add_lru_head_nobalance(cache, list, cline);
|
||||
|
||||
cnt++;
|
||||
|
Loading…
Reference in New Issue
Block a user