you'd also probably want to look at the older zsmalloc version(add compaction and migration later, if need be)https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/mm/zsmalloc.c?id=refs/tags/v4.0it used to be simpler back then. -ss