Recent submissions

Comment · 1 hour ago
Comment · 1 hour ago
If my memory serves my right, theming was built on-top of C preprocessor.
Comment · 6 days ago
Comment · 23 days ago
It is infinitely harder to be first. Once it is known that viable path exists, the task becomes a lot easier
Comment · 25 days ago
I did not rewrite anything.

Yes, I was and still running go and zig binaries with mlockall. Apps have large in-application caches and also perform large streaming reads of datasets bigger than available RAM. If it happens that several streaming reads running at same time, they push memory pressure hard enough, so kernel swaps out cold parts of in-app caches. That later leads to elevated latencies => mlockall to avoid that.

Comment · 25 days ago
That would work reasonably well. With one important caveat: memory controller tracks all memory, including page cache. Setting memory.min will prevent reclaim of page cache charged to that cgroup, as long as total memory usage stays below the limit.
Comment · 25 days ago
I think we are saying the same thing. Active code pages are not evicted; non-active code pages (that is, pages that had not been accessed since last time of active LRU shrinking) may be evicted.
Comment · 25 days ago
All recently referenced code pages in the active LRU are excluded from reclaim.

Code pages are paged in on demand: for any sufficiently large binary just some code pages will be mapped right after start. Given enough memory pressure, the active LRU will be shrunk often enough to push code pages out of the active LRU and then they are eventually evicted.

I'm not aware how it works in modern MGLRU, but I would assume similar ovservable behevior holds.

Comment · 25 days ago
I'm not. If you think that I said something not correct, do correct me. We're all learning.
Comment · 26 days ago
You are correct, of course: if your application needs 2x RAM and you only have 1x, then there is no way mlock can magically save you from swapping. What it gives is protection from a noisy neighbour.

The good thing is that mlock/mlockall does not require elevated permissions. But it is bounded by the memlock rlimit, which you need to configure for the container. If you don't want paging/swapping, set it equal to the total memory you give to the container and call it a day.

I'm curious about the technical implications. Which ones do you have in mind?

To be honest, I don't quite see how mlock makes it complex. It's quite the opposite: it has very clear semantics and makes reasoning about system behavior simple. Disabling swap is the opposite: you're making a bet and hoping it works.

Comment · 26 days ago
Perhaps I wasn't clear, but I did say that all file pages are treated equally. I would assume that page with PC is excluded from reclamation process, but other code pages are valid targets.
Comment · 26 days ago
The op, most likely, was referring to generational GCs. Golang notably doesn't have one.
Comment · 26 days ago
Can you elaborate, why mlock is bad? And how disabling swap is better?

You are correct, that 90MB Go binary is not major memory consumer. But it doesn't matter what is the source of memory pressure. What matters is what kernel do under pressure. If you disable swap, then under memory pressure kernel can only pageout memory mapped files, no matter how small they are. And your code will be paged out.

Comment · 26 days ago
I was biten by not understanding madvise(MADV_WILLNEED) semantics fully. It will prefetch, but it will not pre-fault. You still gonna pay minor page fault on every new page access. There is MADV_POPULATE_READ, but it is synchronous.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton