../04-rdma-pool

目前我们考虑的架构还是以CXL.mem pool最为caching layer, snapshot image实际上还是放在最底层的RDMA pool. 参考前做FaaSMem的RDMA pool是使用FastSwap实现. 由FastSwap架构可以看到其依赖于kernel组件Frontswap将RDMA backend与swap system相连. 而Frontswap组件在kernel v6.6版本中已经惨遭移除. 我们使用的是ubuntu 24.04以及其默认的v6.8的kernel. 想要继续使用FastSwap可能会有困难. 如果降级系统不知道对网卡的驱动有何影响. 目前决定寻找替代方案.

Screenshot 2025-03-04 at 12.05.10image-20250304120620853

一个比较直接的方法就是依赖于uffd, 用uffd连接用户态的RDMA swapping. 先找找相关工作 (列在了最后).

相关工作在看下来, 目前的疑惑有这些:


frontswap探秘

从frontswap存在的最后一个版本v6.5的文档中可以看到以下描述:

Frontswap provides a "transcendent memory" interface for swap pages. In some environments, dramatic performance savings may be obtained because swapped pages are saved in RAM (or a RAM-like device) instead of a swap disk.

A "load" will copy the page, if found, from transcendent memory into kernel memory, but will NOT remove the page from transcendent memory.

另外可以在frontswap的代码中找到以下描述及代码:

/*
 * "Get" data from frontswap associated with swaptype and offset that were
 * specified when the data was put to frontswap and use it to fill the
 * specified page with data. Page must be locked and in the swap cache.
 */
int __frontswap_load(struct page *page)
@@ -195,7 +195,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
   folio_unlock(folio);
   return ret;
  }
- if (frontswap_store(&folio->page) == 0) {
+ if (zswap_store(&folio->page)) {
   folio_start_writeback(folio);
   folio_unlock(folio);
   folio_end_writeback(folio);
@@ -512,7 +512,7 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug)
  }
  delayacct_swapin_start();
 
- if (frontswap_load(page) == 0) {
+ if (zswap_load(page)) {
   SetPageUptodate(page);
   unlock_page(page);
  } else if (data_race(sis->flags & SWP_FS_OPS)) {

这两处描述表明了frontswap上层是swap cache子系统. 这也比较好理解, 就以RDMA作为frontswap的后端时为例子, 每次读取如果都要经过RDMA开销是很大的, 所以swap cache的存在可以减少一下remote access.

但是考虑我们希望能用CXL.mem做RDMA pool的cache. 而swap cache的存在让我们无从下手. 因为我们不能控制swap cache所占用的内存是从哪里来的.


Fastswap相关工作