Better HN
topnewbestaskshowjobs
Log inSign up

delamon

176 karma · joined Nov 30, 2024 (1y ago) · 85 submissions

Submissions

comment 1w ago · link · parent

> On many, many machines 7/24/365

Been there too. The thing I disliked most, that it sometimes get stuck in some strange pose, without any reasonable way of remediation. And because it is so annoying to debug, reboot become the only tool do deal with it.

The sheer complexity of systemd created nasty feedback loop: it is too complex to be debugged; people prefer to reboot it; that keeps problems keep accumulating inside.

comment 3w ago · link · parent

This bring happy memories of picking WM here https://web.archive.org/web/20110718042510/http://www.plig.o... Too bad the web-site is no longer alive.

comment 3w ago · link · parent

If my memory serves my right, theming was built on-top of C preprocessor.

comment 1mo ago · link · parent

(2024)

prev. submission - https://news.ycombinator.com/item?id=39529775

5.

Denmark data breach: it appears that the password was simply 123456(ekstrabladet.dk ↗)

2 points · by delamon · 1mo ago · discuss

comment 1mo ago · link · parent

It is infinitely harder to be first. Once it is known that viable path exists, the task becomes a lot easier

comment 1mo ago · link · parent

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 1mo ago · link · parent

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 1mo ago · link · parent

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 1mo ago · link · parent

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 1mo ago · link · parent

I'm not. If you think that I said something not correct, do correct me. We're all learning.

comment 1mo ago · link · parent

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 1mo ago · link · parent

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 1mo ago · link · parent

The op, most likely, was referring to generational GCs. Golang notably doesn't have one.

comment 1mo ago · link · parent

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 1mo ago · link · parent

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.

comment 1mo ago · link · parent

By that definition, Go has very bad GC. Many (myself included) would strongly disagree with this.

comment 1mo ago · link · parent

They say that persons with protected address had not been leaked.

comment 1mo ago · link · parent

There are two types of pages: anonymous and mapped from files. The code pages are mapped from a binary; they are not very special.

Under memory pressure, the kernel evicts less popular pages from memory. If a page has been mapped from a file, it is dropped (if dirty, then it is written out first). If it is needed later, the kernel can read it back from the file. If a page is anonymous (read: heap page), then there is no backing file and the kernel copies it to swap before dropping it. This is swapping.

So, what happens if you disable swap and the kernel is low on memory? What can it evict? Anonymous pages cannot be evicted: there is no swap to put a copy in. The only choice the kernel has is to evict pages that are mapped from files. Those include pages mapped from the executable. You don't eliminate stalls by disabling swap, you just move them elsewhere: the kernel will page out code and your app gets paused whenever the execution flow hits such a page.

comment 1mo ago · link · parent

If you want you application to stay in memory, then make it explicitly with mlock()/mlockall().

Disabling swap will just moves pressere elsewhere: to code pages. And evicted code page is no better: full stall while kernel loads that page from disk.

comment 1mo ago · link · parent

This is not entirely correct. If you care about latency, then it doesn't matter on which major fault your application gets paused. Disabling swap protects you from data pages being evicted, but code pages can still be paged out.

If you care about latency, mlock() your memory, do not disable swap. Swap is good and gives the kernel an equal opportunity to evict data and code pages.

comment 2mo ago · link · parent

Yes, I mean the code in the drop implementation.

comment 2mo ago · link · parent

I don't quite get it. 5-byte utf-8 encoding gets extra 5 bits compared to 4 byte, and 6-byte gets extra 10 bits. If you were thinking about bits in leading byte, then yes, you are losing one bit for every extra trailing byte, but you also get 6 bits from it. So adding a byte gives you extra 5 bits.

comment 2mo ago · link · parent

Yes, that would work. But you would need to carry pointer to allocator inside box and it is extra code to run for every object.

comment 2mo ago · link · parent

6. modern nvme drive, preferrably pcie gen5 that can push >14GiB/sec

comment 2mo ago · link · parent

They don't play nicely with arena allocators. And arenas is what you reach for if you have clear lifetime bounds: e.g. a single request with arena never de-allocates individual objects, nukes arena when done. That gives you an easy verifiable protection against leaks, data (and cache) locality and deallocation that cost zero cpu cycles.

comment 2mo ago · link · parent

We still have about 85% of codepoint space unused. Hopefully, by the time it becomes a problem, UTF-16 will be long dead

comment 2mo ago · link · parent

I have following lines

  "\e[A": history-search-backward
  "\e[B": history-search-forward
in my .inputrc for years. I think, this is how command line worked in tcsh.

It changes unconditional prev/next to prefix search. With empty command line it is the same as the old behavior. But if you enter "ls" and then press up-arrow, it will scroll through all commands in history that have "ls" as a prefix. I use it much more often than C-r.

comment 2mo ago · link · parent

> Turkey for example has multiple frequencies under 5Ghz WiFi that is banned, hence consumer don't get to use 5Ghz WiFi.

Are you sure? According to wiki, there are plenty allowed 5GHz channels in Turkey.

comment 2mo ago · link · parent

Objects belonging to multiple double-linked lists at the same time. Easily done with intrusive lists. Safe rust would require Rc/Arc: penalty both on memory usage and cpu time.
123