rfjakob / earlyoom

earlyoom - Early OOM Daemon for Linux
MIT License
2.96k stars 157 forks source link

Better support for ancient kernels #281

Closed sgeerts closed 2 years ago

sgeerts commented 2 years ago

We have some embedded devices that are running an ancient linux kernel thus missing some features added in later kernels.

These are the changes we needed to make to get it to run on those kernels

Probably should have checked the pull requests because they contained the same fixes (in one form or another) but live and learn.

Not too enthused about storing a pid in a var named pidfd but it was the neatest solution I could think of

rfjakob commented 2 years ago

Huh, messy.

I think I'd prefer to (partially) revert https://github.com/rfjakob/earlyoom/commit/2e004040deb5b30880d72740bd71095e326479de . The pidfd thing is nice and shiny, but it solves theoretical problems and causes real issues as we see here.

sgeerts commented 2 years ago

A somewhat clean option I could think of was to separate the kill_wait function into two versions, one for pidfd/mrelease and one for legacy systems. The pidfd/mrelease fit meshed together quite well, it's just the pidfd vs pid that didn't jive. But like you said, I'm not sure how theoretical the problem is that pidfd is trying to solve.

I'll ponder a clean solution for a little while longer, but this PR has run it's course