Skip to content

Commit 7c85749

Browse files
IvanTopolcicmeta-codesync[bot]
authored andcommitted
add admin slab release command
Summary: Adds a new `release-ac-slabs` admin command to the ucache admin command handler that releases slabs from a specified allocation class back to the pool via CacheLib's `releaseSlab()` API. **Usage:** ``` uc release-ac-slabs <class_id> [--count N] ``` **Arguments:** - `class_id` — allocation class index (0-based) - `--count N` — number of slabs to release (default: 1) **Example:** ``` uc release-ac-slabs 5 --count 3 ``` This releases 3 slabs from allocation class 5. Each slab release is timed and logged individually. If a release fails, the command stops and reports the error. To make `CacheAllocator::releaseSlab()` accessible from ucache, `UcacheAdminCommandHandler` is added as a friend class in `CacheAllocator.h`, keeping the method private rather than exposing it publicly. Reviewed By: AlnisM Differential Revision: D100408757 fbshipit-source-id: 17217df0c54f4820e3f11102653b2755306cbe85
1 parent 1de8715 commit 7c85749

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

cachelib/allocator/CacheAllocator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,7 @@ class CacheAllocator : public CacheBase {
19081908
.poolId = allocInfo.poolId});
19091909
}
19101910

1911+
public:
19111912
// Releases a slab from a pool into its corresponding memory pool
19121913
// or back to the slab allocator, depending on SlabReleaseMode.
19131914
// SlabReleaseMode::kRebalance -> back to the pool
@@ -1959,6 +1960,7 @@ class CacheAllocator : public CacheBase {
19591960
SlabReleaseMode mode,
19601961
const void* hint = nullptr) final;
19611962

1963+
private:
19621964
// @param releaseContext slab release context
19631965
void releaseSlabImpl(const SlabReleaseContext& releaseContext);
19641966

0 commit comments

Comments
 (0)