diff options
| author | Pierre Barre <pierre@barre.sh> | 2025-10-16 15:58:36 +0200 |
|---|---|---|
| committer | Dominique Martinet <asmadeus@codewreck.org> | 2025-11-03 16:41:24 +0900 |
| commit | e21d451a82f39e91b7635c4fc3ff5ac082873ec3 (patch) | |
| tree | c5c85f3847d891ebb60e0718e4298896b7ca9bae /rust/helpers/vmalloc.c | |
| parent | 43c36a56ccf6d9b07b4b3f4f614756e687dcdc01 (diff) | |
9p: Use kvmalloc for message buffers on supported transports
While developing a 9P server (https://github.com/Barre/ZeroFS) and
testing it under high-load, I was running into allocation failures.
The failures occur even with plenty of free memory available because
kmalloc requires contiguous physical memory.
This results in errors like:
ls: page allocation failure: order:7, mode:0x40c40(GFP_NOFS|__GFP_COMP)
This patch introduces a transport capability flag (supports_vmalloc)
that indicates whether a transport can work with vmalloc'd buffers
(non-physically contiguous memory). Transports requiring DMA should
leave this flag as false.
The fd-based transports (tcp, unix, fd) set this flag to true, and
p9_fcall_init will use kvmalloc instead of kmalloc for these
transports. This allows the allocator to fall back to vmalloc when
contiguous physical memory is not available.
Additionally, if kmem_cache_alloc fails, the code falls back to
kvmalloc for transports that support it.
Signed-off-by: Pierre Barre <pierre@barre.sh>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
Message-ID: <d2017c29-11fb-44a5-bd0f-4204329bbefb@app.fastmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'rust/helpers/vmalloc.c')
0 files changed, 0 insertions, 0 deletions
