From 9eea72cc6d72f3868c9b473c526569a265667c29 Mon Sep 17 00:00:00 2001 From: haochengxia Date: Mon, 4 Aug 2025 23:16:20 +0000 Subject: [PATCH 1/4] Add note in S3FIFO for small insertion --- libCacheSim/cache/eviction/S3FIFO.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libCacheSim/cache/eviction/S3FIFO.c b/libCacheSim/cache/eviction/S3FIFO.c index cb565831..1e2044f1 100644 --- a/libCacheSim/cache/eviction/S3FIFO.c +++ b/libCacheSim/cache/eviction/S3FIFO.c @@ -265,6 +265,10 @@ static cache_obj_t *S3FIFO_insert(cache_t *cache, const request_t *req) { obj = main_fifo->insert(main_fifo, req); } else { /* insert into small fifo */ + // NOTE: Inserting an object whose size equals the entire cache size is NOT + // allowed. Doing so would completely fill the cache, causing all existing + // objects to be evicted. This scenario can occur frequently and is + // undesirable. if (req->obj_size >= small_fifo->cache_size) { return NULL; } From ef6fa060d25cae58c961851ef3238c3f4adceac8 Mon Sep 17 00:00:00 2001 From: haochengxia Date: Mon, 4 Aug 2025 23:20:26 +0000 Subject: [PATCH 2/4] Make it more clear --- libCacheSim/cache/eviction/S3FIFO.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libCacheSim/cache/eviction/S3FIFO.c b/libCacheSim/cache/eviction/S3FIFO.c index 1e2044f1..bfa882e6 100644 --- a/libCacheSim/cache/eviction/S3FIFO.c +++ b/libCacheSim/cache/eviction/S3FIFO.c @@ -265,10 +265,10 @@ static cache_obj_t *S3FIFO_insert(cache_t *cache, const request_t *req) { obj = main_fifo->insert(main_fifo, req); } else { /* insert into small fifo */ - // NOTE: Inserting an object whose size equals the entire cache size is NOT - // allowed. Doing so would completely fill the cache, causing all existing - // objects to be evicted. This scenario can occur frequently and is - // undesirable. + // NOTE: Inserting an object whose size equals the size of small fifo is + // NOT allowed. Doing so would completely fill the cache, causing all + // existing objects to be evicted. This scenario can occur frequently and + // is undesirable. if (req->obj_size >= small_fifo->cache_size) { return NULL; } From 035d832c7757f8934e60081cd70eabbf11260d96 Mon Sep 17 00:00:00 2001 From: haochengxia Date: Mon, 4 Aug 2025 23:21:25 +0000 Subject: [PATCH 3/4] More direct --- libCacheSim/cache/eviction/S3FIFO.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libCacheSim/cache/eviction/S3FIFO.c b/libCacheSim/cache/eviction/S3FIFO.c index bfa882e6..5ec4c410 100644 --- a/libCacheSim/cache/eviction/S3FIFO.c +++ b/libCacheSim/cache/eviction/S3FIFO.c @@ -266,9 +266,9 @@ static cache_obj_t *S3FIFO_insert(cache_t *cache, const request_t *req) { } else { /* insert into small fifo */ // NOTE: Inserting an object whose size equals the size of small fifo is - // NOT allowed. Doing so would completely fill the cache, causing all - // existing objects to be evicted. This scenario can occur frequently and - // is undesirable. + // NOT allowed. Doing so would completely fill the small fifo, causing all + // existing objects in small fifo to be evicted. This scenario can occur + // frequently and is undesirable. if (req->obj_size >= small_fifo->cache_size) { return NULL; } From def283ad8ed66ea2982a56cdf2cc6161a5a59d5a Mon Sep 17 00:00:00 2001 From: Juncheng Yang <1a1a11a@users.noreply.github.com> Date: Tue, 5 Aug 2025 09:55:14 -0400 Subject: [PATCH 4/4] Update S3FIFO.c --- libCacheSim/cache/eviction/S3FIFO.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libCacheSim/cache/eviction/S3FIFO.c b/libCacheSim/cache/eviction/S3FIFO.c index 5ec4c410..d3668e79 100644 --- a/libCacheSim/cache/eviction/S3FIFO.c +++ b/libCacheSim/cache/eviction/S3FIFO.c @@ -267,8 +267,8 @@ static cache_obj_t *S3FIFO_insert(cache_t *cache, const request_t *req) { /* insert into small fifo */ // NOTE: Inserting an object whose size equals the size of small fifo is // NOT allowed. Doing so would completely fill the small fifo, causing all - // existing objects in small fifo to be evicted. This scenario can occur - // frequently and is undesirable. + // objects in small fifo to be evicted. This scenario may occur + // when using a tiny cache size. if (req->obj_size >= small_fifo->cache_size) { return NULL; }