[GH-ISSUE #2033] [Enhancement] Mark conversation cache MADV_COLD to use swap preferentially on Linux #808

Closed
opened 2026-11-04 01:46:07 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Interpause on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2033

On a 64GB system running IQ3_S, there is no RAM left for a conversation cache. However, in long-running agentic workloads, this can lead to quite a bit of time reprocessing context (~30s on avg for me).

My suggestion is to mark conversation cache memory allocation as MADV_COLD, which on Linux indicates to the kernel that these allocations can be opportunistically moved to swap. The time taken to move cached convos from swap back to VRAM should be much faster. And this would work transparently vs disk-backed cache which has code complexity, staleness issues and requires manual operation via the slot save & load routes. The downside of course is that swap-backed cache isn't disk-backed.

I am not sure if even more can be done besides MADV_COLD, for example to outright allocate on swap or protect the limited RAM left being used between whatever strata puts into disk-backed page cache and other system processes.

I will try making the modification to see if the added memory pressure causes any issues.

Originally created by @Interpause on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2033 On a 64GB system running IQ3_S, there is no RAM left for a conversation cache. However, in long-running agentic workloads, this can lead to quite a bit of time reprocessing context (~30s on avg for me). My suggestion is to mark conversation cache memory allocation as MADV_COLD, which on Linux indicates to the kernel that these allocations can be opportunistically moved to swap. The time taken to move cached convos from swap back to VRAM should be much faster. And this would work transparently vs disk-backed cache which has code complexity, staleness issues and requires manual operation via the slot save & load routes. The downside of course is that swap-backed cache isn't disk-backed. I am not sure if even more can be done besides MADV_COLD, for example to outright allocate on swap or protect the limited RAM left being used between whatever strata puts into disk-backed page cache and other system processes. I will try making the modification to see if the added memory pressure causes any issues.
Author
Owner

@Interpause commented on GitHub (Oct 12, 2026):

Or if #1937 goes ahead, it might be better, my proposal is more of a stopgap.

<!-- gh-comment-id:6117931485 --> @Interpause commented on GitHub (Oct 12, 2026): Or if #1937 goes ahead, it might be better, my proposal is more of a stopgap.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270759076 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#808
No description provided.