obmmalloc:

分支1Tags0
当前项目代码仓暂无内容

obmmalloc

malloc-style allocator on the OBMM global shared-memory pool: L1 distributed CAS chunk allocator (1 GB granularity, 128 TB pool) + L2 jemalloc extent_hooks adapter. See docs/DESIGN.md for the full design.

Build

# needs jemalloc (dev headers) + cmake
cmake -B build && cmake --build build
ctest --test-dir build          # 7 tests

Pool assembly

obmmalloc_pool_init_file() assembles the same-VA global pool from OBMM exports on every node — one JSON config, identical everywhere. Each entry is one exported memory segment (in slot order):

{
  "pool_base_va": "0x100000000000",
  "segments": [
    { "cna": "0x101", "eid": 1, "tokenid": 0, "uba": "0xffffff000000", "len": "0x1000000" },
    { "cna": "0x201", "eid": 1, "tokenid": 2, "uba": "0xffffff000000", "len": "0x1000000" }
  ]
}

The library discovers this node's local CNA set from sysfs (one CNA per iodie), maps local segments via their export shmdev and remote segments via decoder MAP + import, all at consecutive VAs — then bootstraps the allocator on the assembled pool.

#include "obmmalloc_pool.h"

if (obmmalloc_pool_init_file("pool.json") < 0) { /* error */ }
void *p = obmmalloc_malloc(64 * 1024);   /* global shared allocation */
obmmalloc_free(p);

Alternatively, when the caller already has the pool mapped at a fixed VA (e.g. pre-provisioned), obmmalloc_init(pool_va, size, node_id, cache) brings the allocator up directly.

License

Mulan PSL v2.