Torvalds Warns the World: Don't Use the Linux 5.12-rc1 Kernel


levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
14,747
Location
Somewhere off the coast of the EU
How do you know it's being used though? I guess if you had good enough hearing, you could listen for the hard disc seeking, if you still use one, or hang on the HDD usage light. Seems simpler to me to not use swap and see if something crashes, then enable it and see if it fixes it.
 

sebt3

homebrew player (P. & C.)
Joined
Sep 9, 2008
Messages
4,863
Age
41
Location
France
Website
sebt3.openpandora.org
How do you know it's being used though?
Here is how it looks on my laptop :
Code:
$ LANG=C free -m
               total        used        free      shared  buff/cache   available
Mem:           11890        7181        1214        1431        3493        2958
Swap:           2048           0        2048
That 0 on the "Swap:" line mean it's unused.
Note : the "buff/cache" column show you how much disk cache your system does to speed thing up. Linux will use all the "free" RAM for cache as much as useful, yet most of it can be freed instantly hence the "available" column. Beware, your system doesn't start to reduce speed when it's starting to use swap, but when it start freeing buffer/cache for apps memory... Hence my position against swap and opting to buy more RAM ;)

PS: yeah, i'm using swap... but I have alerting if it become used. It's just a fail-safe against oomkiller.
PPS: that LANG=C in the command line only force output in english instead of my frenchy
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,512
Location
Detroit, Michigan
Website
Visit site
the most obvious use of swap Ive personally had is with my NSA320. When copying a large file once it filled the physical memory it would stop. Adding the swap file fixed the problem.
most modern machines dont really need it, but smaller devices it still has a use.
 

Linux-SWAT

Hardcore Member
Joined
Feb 13, 2010
Messages
8,963
How do you know it's being used though? I guess if you had good enough hearing, you could listen for the hard disc seeking, if you still use one, or hang on the HDD usage light. Seems simpler to me to not use swap and see if something crashes, then enable it and see if it fixes it.
You can't hear that in a server room.
Same with servers providing critical services to users, you really want to avoid a crash.
There's plenty of monitoring software around which can report hardware usage to sysadmins.
 
Last edited:

netcat

Very Active Member
Joined
May 3, 2016
Messages
502
Location
city of thieves
i lied i use swap too.
on my little vm creating a swap file on / was the only way to have enough memory to generate daily reports of all the hack attempts
i'm getting like 44k failed ssh logins daily from a botnet. yay.

here's another way to observe swapping:
bpftrace -e 'software:faults:1 { @[comm] = count(); }'

but it might quite alarming for you, as it is for me.

THERE IS JAVA RUNNING ON MY MACHINE!!!!
 

JDTAY

Half Pepperoni, All Cheese
Joined
Sep 15, 2015
Messages
2,423
Age
34
Location
North Carolina, USA
i'm getting like 44k failed ssh logins daily from a botnet. yay.
Aren't we all?

I've been thinking that it might be time to take down the internet, because it's not secure enough. Old habits die hard though. Especially in America, where our main export is ones and zeroes. Wouldn't want the world to run out of those.
 

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
14,747
Location
Somewhere off the coast of the EU
the most obvious use of swap Ive personally had is with my NSA320. When copying a large file once it filled the physical memory it would stop. Adding the swap file fixed the problem.
most modern machines dont really need it, but smaller devices it still has a use.
That's odd. I don't use SWAP and the ram in my server is 4GB, yet I regularly copy files just north of 4GB to my USB attached backup disc. I assumed copy worked much like it did on old 8- and 16-bit machines where it would copy blocks using most of the memory, and if it didn't fit it would have to do it in two or more steps.
 

Nilsnsn

Member
Joined
Jun 3, 2012
Messages
86
Location
Braunschweig
i lied i use swap too.
on my little vm creating a swap file on / was the only way to have enough memory to generate daily reports of all the hack attempts
i'm getting like 44k failed ssh logins daily from a botnet. yay.

here's another way to observe swapping:
bpftrace -e 'software:faults:1 { @[comm] = count(); }'

but it might quite alarming for you, as it is for me.

THERE IS JAVA RUNNING ON MY MACHINE!!!!
for me changing the ssh server port, using fail2ban and disabling login with password got rid of those login attempts
 

netcat

Very Active Member
Joined
May 3, 2016
Messages
502
Location
city of thieves
for me changing the ssh server port, using fail2ban and disabling login with password got rid of those login attempts
i was originally thinking fail2ban wouldn't help against a botnet, but i see 639 distinct ip's..
that means i could reduce the hacks by 98.5% in any given day, possibly more over time. good shout.
but it hasn't been an issue for me, other than forcing me to use swap, which is actually pretty damn embarassing
 

Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,512
Location
Detroit, Michigan
Website
Visit site
That's odd. I don't use SWAP and the ram in my server is 4GB, yet I regularly copy files just north of 4GB to my USB attached backup disc. I assumed copy worked much like it did on old 8- and 16-bit machines where it would copy blocks using most of the memory, and if it didn't fit it would have to do it in two or more steps.

This is a little box dedicated to be a NAS, but only come with 512 mb ( a lower spec unit has 256 mb)
 

elw3

ƐʍlƎ
Joined
Aug 10, 2010
Messages
1,648
There's not a single way an SSD can be faster than RAM.
The CPU have a direct connection to the RAM (well with multi socket systems it's a little more complicated, but lets forget this for a bit). An M.2 drive is piloted by the CPU throw interrupts, these interrupts go throw the south-bridge to enter the PCI-e line then get to the M.2 controller that indirect the call to the actual drive. The buffer follow the road back to the main data line where it enter ... the fucking RAM...
How the fuck all these indirections that finally endups in the RAM can be faster than the RAM itself ? Could you explain me this ?

Do you know how the linux kernel work ? Any write to a disk is cached into RAM so the write is faster for the program, the kernel making sure the data is written to disk in an async fashion. (yeah async write is the default. Getting sync write is actually cumbersome and a bit convulted).
Removing RAM from a computer would requiere a completly new hardware design and a completly new OS design. While the linux kernel is the most versatile kernel ever written, it would need a complet redesign for your idea to works. A redisign that would make the 1.x->2.0 and the 2.2->2.4 redisigns as mer simple patches...

BTW, I was talking about software architecture used in datacenter. kubernetes is pretty much this. Google, amazon and a few others are running using kubernetes, thuss without any swap... I guess you think you understand better hardware than the google engineers that designed kubernetes and the hardware it's running on top of...
You fail to grasp what i wrote:
Time critical accesses are cpu cached so speed doesnt matter.
And for a large amount of data sata speed is close enough to ram speed to still have the cpu the bottleneck.
Its piped through the ram, yea so? The idea is to have a shitload of storage and to save energy by powering less hardware, not to have that storage react in milliseconds.
Cache your writes in a gig of ram and let the ssd do the dirty work was the idea. Not fucking redesign hardware, who said that?
specifically: 100 megapixel images can fit easily in 4G of ram
Funny how gimp needs several gb to open it then.
And yes there is an argument for it, it prevent out of memory kills. But i am all for not having it a default as there are more memory leaks than actual programs that need much memory.
As I read it, old DDR2-400 RAM has a bandwidth of 3200MB/s, while modern SATA has a rated bandwidth of up to 6Gb/s, which is 750MB/s.
I always confuse bit with byte, but whatever, everything with less than two digits difference is the same.
 

Linux-SWAT

Hardcore Member
Joined
Feb 13, 2010
Messages
8,963
Be careful because a byte isn't necessarily 8 bits on every architecture.
That's why it's more accurate to use the octet instead.
 

netcat

Very Active Member
Joined
May 3, 2016
Messages
502
Location
city of thieves
Time critical accesses are cpu cached so speed doesnt matter.
your bulldozer has like 8mb of l3 cache and you're talking about 100 mpx so it's page faulting continuously

The idea is to have a shitload of storage and to save energy by powering less hardware, not to have that storage react in milliseconds.
milliseconds? ssd latency is 10-100 microseconds, ram 100 nanoseconds.

i believe your system is non-performant

is it by any chance kwapd maxing your cpu? :)

i recommend the following simple test to guage ram vs ssd:

write a large file to ssd. it should be big enough to fit in your memory, say 2g. reboot.

run this command twice:

$ time cat file > /dev/null

the second time the file should be read from ram cache.

divide the first number by the second. that is how much faster ram is than ssd.
 
Last edited:

matzesu

Forum Addict!
Staff member
Joined
Oct 24, 2008
Messages
11,572
Age
37
Location
Germany,, Saarland, at home
On one side I don’t think I would ever need swap on the Pyra, but on another side I have blender installed..
(Although I don’t know how to use it yet )
 

elw3

ƐʍlƎ
Joined
Aug 10, 2010
Messages
1,648
your bulldozer has like 8mb of l3 cache and you're talking about 100 mpx so it's page faulting continuously
Funny how this feels like trying to explain something to a child:
The 100mpx jpg will expand to a several gb raw file when opening it in gimp. The view will be saved in the graphic memory so accessing this huge file effectively only happens when i zoom in or perform alterations on the whole picture.
In the first case reading the needed parts happens within the 1/60 time frame of your monitors refresh rate, you will not see any difference in where it is read from.
In the second case the cpu is the bottleneck for any editing.
In this very scenario of picture editing i get a better workstation when investing money in an SSD than in more ram.

Was this explanation easy enough for you?
milliseconds? ssd latency is 10-100 microseconds, ram 100 nanoseconds.

i believe your system is non-performant
Are you by any chance one of those who hate movies because they are unrealistic?
Or think that ppl actually laugh when writing lol?
I am not writing literally you see, milisecond just means some random fast sounding word. It could say femtosecond or bogotime, still the same sentence cause the meaning was simply fast.
run this command twice:

$ time cat file > /dev/null
Thank you very much for this piece of trivial noob advise. How could i ever live without it?
But if it interests you that much, there for a 1gb file:
real 0m2,090s
real 0m0,535s
Oh you expected a bigger difference? What for would i need that?
 

FBnil

my lonely NES is skilling me
Joined
Dec 14, 2012
Messages
4,346
Location
Yurp
How about https://www.howtogeek.com/442733/how-to-use-port-knocking-on-linux-and-why-you-shouldnt/
In the past, like 20 years ago, I also had range knockers. I've tried a lot of techniques, like: answering on every port (and then keeping quiet) so to delay their portscanning. I mimicked a windows machine with my Linux, and was hammered instead. And a reverse of portknocking, where if you try to ping my unexisting windows networkprinter port, the IP gets banned for 1 minute (enough for it to start on the next IP address). I once got angry and hacked back, only to find it was an infected Windows machine, from an unsuspecting user that just had their windows wide open. So now I just disabled outside access. Some times I open up my https (when I want to share a file with a friend), but I use it more as a computer, not as a server


About the swap discussion: I need swap for FireFox or I cant have all my tabs open without running out of memory and lockiing up my Linux. Edit: my flavour of YTdownloaded leaks like crazy.

For developing certain type of scripts that process a large input datafile I also made use of a RAM disk that made re-running code so much faster (when either crunching large datafiles, or binding large datastructures to disk, so that the data is still somewhat fast to access). Today I use the shared memory /dev/shm/ that is actually the same; I just need to be careful not to fill it up.

Oh you expected a bigger difference? What for would i need that?
A real example would be brute-force cracking a zipfile locked with a password. Even small differences in speed help a lot.
 
Last edited:
Top