Commit 432ffa7
use a bit in CacheItem to indicate if it is a large item
Summary:
During NVM promotion in NvmCache::createItem(), we set the kNvmLargeItem flag on the DRAM item to track whether its NVM copy lives in BlockCache or BigHash. This flag is later used at DRAM eviction time (e.g., to populate the AccessTimeMap for BlockCache items).
The size check that determines this — smallItemMaxSize_ == 0 || key.size() + nvmItem.totalSize() > smallItemMaxSize_ — was duplicated in both branches of createItem() (the makeObjCb path and the standard memcpy path). This duplicates the routing logic from EnginePair::isItemLarge() and is easy to get out of sync if the threshold semantics ever change.
Extract the check into a private isNvmItemLarge(key, nvmItem) helper with a comment explaining how it mirrors the Navy-side routing: EnginePair::isItemLarge() compares key.size() + value.size() against smallItemMaxSize_, and since the put() path passes toIOBuf(nvmItem) to Navy, value.size() == nvmItem.totalSize().
Reviewed By: rlyerly
Differential Revision: D98267676
fbshipit-source-id: f54d9a35d9fbff5a30807f6bea4991beab1bac6e1 parent f280dee commit 432ffa7
File tree
4 files changed
+73
-2
lines changed- cachelib/allocator
- nvmcache
- tests
4 files changed
+73
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
255 | 262 | | |
256 | 263 | | |
257 | 264 | | |
| |||
735 | 742 | | |
736 | 743 | | |
737 | 744 | | |
738 | | - | |
| 745 | + | |
| 746 | + | |
739 | 747 | | |
740 | 748 | | |
741 | 749 | | |
742 | 750 | | |
743 | 751 | | |
744 | | - | |
| 752 | + | |
745 | 753 | | |
746 | 754 | | |
747 | 755 | | |
| |||
866 | 874 | | |
867 | 875 | | |
868 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
869 | 887 | | |
870 | 888 | | |
871 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
422 | 426 | | |
423 | 427 | | |
424 | 428 | | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1430 | 1430 | | |
1431 | 1431 | | |
1432 | 1432 | | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1433 | 1436 | | |
1434 | 1437 | | |
1435 | 1438 | | |
1436 | 1439 | | |
1437 | 1440 | | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
1438 | 1444 | | |
1439 | 1445 | | |
1440 | 1446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2978 | 2978 | | |
2979 | 2979 | | |
2980 | 2980 | | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
2981 | 3017 | | |
2982 | 3018 | | |
2983 | 3019 | | |
0 commit comments