Linux Kernel Fastboot [pdf]
linuxplumbersconf.org
linuxplumbersconf.org
This brings me back to the heydays of Sun Microsystems where they controlled both the hardware (SPARC) and the operating system (Solaris). Sun didn't hesitate to use this to their advantage. With Clear Linux, I see Intel doing some very similar things. Yes, this was just a story about boot time, but it led me to take a look at Clear Linux and it looks like it could be a star. I'm interested in how much more performance their distribtuion is able to squeeze out. I'm also wondering how they're dividing their focus here and what high notes they're trying to achieve.
At a strategic level, I'm assuming that they're wanting to distinguish themselves from ARM? Are they looking to create a well-tuned reference for other Linux distributions on Intel to adopt? At a tactical level, I see they're focusing on performance, availability (which boot time would be a function of)... but are they tweaking for other things such as reliability? Fault tolerance?
Until now, Clear Linux wasn't even on my radar. Today, it is. Anyone have some experiences with this distro (for better or worse) that they'd like to share?
Not much of one, but for a while I was playing with multiple distros trying to find the best possible power management for my laptop. (XPS 13 9380.)
Clear did better than the Ubuntu installation that came with it -- but a dead octopus would have done better than that. It was sitting at 6W for non-CPU-intensive work, and was also noticeably snapppier. Windows on the same hardware sits at 8W when idling; same as Ubuntu.
More recently I've tried Arch, though. Which somehow got that same workload down to 3.3W, albeit with a lot of adjustments... that didn't seem to affect performance, but did affect power use, clearly.
It's just too bad that all of this optimization goes out the window if I fire up a browser, but I've had a fun time finding ways to avoid that.
Apart from that, obviously Clear's software repository is far more limited than Arch's, and it also seems harder to contribute to. I don't think that problem will be going away soon.
Using Arch often gives me advance warning that my apps will break on users machines due to changes in libraries. I see the changes first and can add compatibility for the new library version such that it's fixed before affecting my users.
I love it as a daily driver.
Totally agree that it's a great daily driver. It has EVERYTHING!
- Force deep sleep mode, as s2idle doesn't work.
- Set the ASPM policy. To anything. Basically the default doesn't work. (I went with 'powersave', obviously.)
- Run powertop --auto-tune on boot.
- Set the cool-bottom thermal profile, but that's just to make it work as a lap top.
- Run a BIOS upgrade. :V
(fwupdmgr did the whole job for me~)
If you have a SSD you can be aggressive on the disk suspend timeout, as there's no spin up/down wear issue as with mechanical disks.
With this the battery life is good enough that I never felt the need to optimize further.
Some modules also have blacklists that prevent certain power saving modes from being enabled. This is true for the snd-hda-intel module to prevent a well known popping sound. Since disabling the blacklist, I haven't encountered the issue however YMMV. Similarly to enable ASPM on the PCIE bus, I've had to force it via a kernel parameter.
With regards to the GPU, I noticed my Intel GPU can scale its frequency between 300mhz and 950mhz but the default minimum was set to 350mhz. Other such tweaks such as enabling frame buffer compression [4], can save you a few more watts.
While the Linux defaults does its best to be suitable across different hardware configurations, you'll have to meddle with many parameters to get it customised to your configuration, and that could bring some instability with it so exercise some caution.
Oh, and also be mindful of the apps you run. The Great Suspender for Chrome can save you some watts, cpu and memory by suspending tabs that are not in use. And switching to a light desktop such as Sway or i3 can also do wonders.
As I type this, my battery is reporting a draw of 3.1 watts, 30% battery remaining with 4:40 of operating time at the current workload.
[1] - https://wiki.archlinux.org/index.php/TLP
[2] - https://hansdegoede.livejournal.com/18412.html
[3] - https://wiki.archlinux.org/index.php/Power_management#SATA_A...
[4] - https://wiki.archlinux.org/index.php/Intel_graphics#Framebuf...
I'm assuming you used Powertop on Linux.
For Windows, I simply let the laptop run until it had used 50% of the battery. Watts = Joules / second.
On Linux, I used the same methodo to calibrate against powertop. (But found less than 5% of discrepancy anyway.)
You should use the same methodology for both.
That estimate is usually accurate, but it can drift a bit over time if you never fully recharge or discharge the battery. Also, when the battery gets old it starts having trouble delivering full current when mostly discharged, which is why you'll sometimes see shutdowns at 5-15% remaining.
If we are talking about battery-life at least.
In fact, what mobile device manufacturers have learned is that the best way to save power is to ramp up power to complete a non-IO task in as little time as possible then go back to a lower TDP as that is where peak efficiency (rather than minimal consumption) lies.
I think most people are interested in their battery life when they are measuring their battery life.
Numbers you get while plugged in won't have any relevance to battery life or performance. That even applies to mobile devices, despite their learnings.
ext4 doesn't detect corruption. How am I supposed to trust it?
I get what you're saying about the filesystem. Personally, I use par2 for the most important things (photos).
I got the laptop to have well-supported hardware, not because I was expecting a lot of help from Dell.
And no, it seems they didn't. They haven't forced deep sleep, for example.
My Dell has an Sk Hynix NVMe drive that apparently doesn't have safe write on power failure. I know because it somehow woke up in my bag and ran the laptop battery down to 0.
BTRFS was not happy with the state of anything on the drive. I was able to do a rescue copy and verify it with my backups, so after a full restore everything turned out OK.
Also, NVIDIA CUDA drivers didn't work. Not sure who's fault that is. Probably both NVIDIA and Intel's.
All in all, it did boot quickly on AWS, but it was not a fun time at all.
Most of the useful apps are available via flathub, which it comes with so you just install slack, vscode, etc. that way.
Also, its package manager forces you to install "bundles" of somewhat related packages rather than just the specific packages you want and their deps. Maybe I'm missing something, but I find this very odd.
This is a common misconception. It's not built with ICC, it's built with GCC (and some parts maybe with Clang).
When did you try Clear? They have about 6200 packages now, but I'm not sure if that's still "limited" in relative terms.
Last time I tried it was a couple of months ago. I don't recall what it was missing, but it was some core part of my normal python development environment.
I'd urge some caution. It depends on your use case and the accuracy requirements you have. Clear Linux gets a chunk of its speed boosts by using compiler optimisations that most distributions won't touch because of the possibility they'll reduce accuracy and move outside the bounds of various standards, e.g. --ffast-math. Clear Linux also sets it so that by default when you go to compile stuff, it ends up picking up their "optimised" set of compiler flags too.
It works, it's fine, it's fast. Just make sure you know what you're getting and what the consequences for your software might be (I'm sure most people _don't_ have strict IEEE standards to care about, for example)
Interestingly AWS virtual machines still boot in 16-bit mode, then bootstrap up through 32 and then 64 bit modes, last I heard.
https://devblogs.microsoft.com/oldnewthing/20030814-00/?p=42...
It's probably a good idea to audit all the things that are autosized at boot by ram size; some of them are probably much too large on a system with 128 GB or so, given some of the sizing was written when 128 MB was big. I know I've run into the size of IP fragment buffers being way too big, but not sure what else.
There was a bug in a proposed kernel patch a while back, that we were testing. It ended up designating a good chunk of the machine's RAM as hotpluggable. Test suite was passing, but the benchmarks showed a drastic performance drop. Took a while to track down why that was happening.
Here's a patch of mine that added (some of) it from 2005: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
What is going on that makes this 2:1?
And in this case they don't appear to be using any initrd for the root filesystem, just hurrying to bring up access to the full filesystem over eMMC.
If you have 2GB of RAM, 2GB of "other stuff" in the first 4GB, and specify mem=4096m, you'll end up with a kernel that sees 2GB of RAM.
That's pretty interesting. Wonder what it is doing?
It wouldn’t necessarily have to be done synchronously up front at all, except when the BIOS hands off control of the system to the SATA controller it expects that afterward it has a definitive list of available boot devices and their properties, for selection/display in the boot menu and BIOS configuration.
Theoretically with UEFI and it’s NVRAM-resident settings, a boot device could be expressed as a namespace and path, and the firmware need not enumerate devices until it has determined that there’s a need to search for alternative/fallback boot devices, but the stack hasn’t been updated with that in mind.
The hard drive predelay is also not as obsolete as you may think; I've encountered high-capacity SATA SSDs that take a surprisingly long time to come up after being hotplugged, to the point that Linux doesn't always succeed in bringing up the link on the first try.
I’m willing to bet if the stack enforced tighter tolerances for modern non-rotating disks, manufacturers wouldn’t be able to slip such shoddy firmwares into production.
Such high quality discussion too!
While it’s a joke, they’re not particularly far from the truth, as noted in a different comment here. They do indeed wait for some parts to respond.
Surely not all of systemd is faulted in immediately, is this really an issue?
In /proc/1/smaps, I find the following executable mapping:
55aa05f89000-55aa06076000 r-xp 00000000 fd:01 1823 /lib/systemd/systemd
Size: 948 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 752 kB
Pss: 489 kB
Shared_Clean: 504 kB
Shared_Dirty: 0 kB
Private_Clean: 248 kB
Private_Dirty: 0 kB
Referenced: 740 kB
Anonymous: 0 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
VmFlags: rd ex mr mw me dw
So it appears 740KiB has been referenced, 752KiB resident.There's also the read-only mapping:
55aa06076000-55aa0609b000 r--p 000ec000 fd:01 1823 /lib/systemd/systemd
Size: 148 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 148 kB
Pss: 74 kB
Shared_Clean: 0 kB
Shared_Dirty: 148 kB
Private_Clean: 0 kB
Private_Dirty: 0 kB
Referenced: 148 kB
Anonymous: 148 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
Shared_Hugetlb: 0 kB
Private_Hugetlb: 0 kB
Swap: 0 kB
SwapPss: 0 kB
Locked: 0 kB
THPeligible: 0
VmFlags: rd mr mw me dw ac
Another 148KiB, so 900KiB, a good chunk of the 1.1MiB - though this is with a substantial uptime.The really disgusting part is all the dependencies; `pmap 1` says 57MiB total, and there's not much anonymous memory to blame.
―
¹ At least on GCC but I would be very surprised if clang doesn't also do this.
² You can also do this manually with __attribute__((hot)) and __attribute__((cold))
https://web.archive.org/web/20100223202038/http://blog.mozil...
> Rootfs Mouting -> Rootfs Mounting ?
Linux (as in, the kernel) is extremely stable and well tested.
If the components in question utilise any significant features of the kernel, I strongly doubt some homegrown kernel-esque project will achieve more stability and reliability than Linux.
Sure, if it can be done with a (minimal) amount of embedded code then it quite possibly should be, but if a whole kernel is actually needed then Linux is a fine choice.
E.g. new Mazdas have a Linux distro with DBus communicating between binaries and Opera browser to show UI. The actual UI is written in JavaScript and HTML.