9 ms·
AMD has a one-liner to help speed up Linux system resume time
- hardware2win 3y agoAh, the most powerful optimization technique: add random sleeps to the code and when people start complaining remove them and collect your bonus </joke>
- techwiz137 3y agoReminds me of the post about the loop which did nothing but take up cycles. And reducing the number of loops sped up the software. Can't remember which one it was.
- Zinggi 3y agoPretty sure you mean this one: https://thedailywtf.com/articles/The-Speedup-Loop https://thedailywtf.com/articles/The-Speedup-Loop
- pluijzer 3y agoWhen I was a child writing games with QBasic, my simple text adventures would load up instantly. Though all the professional made games I played had loading screens. So I added a progressbar with some for loops to make my game more professional. 500 iterations was about 1 second I remeber (on my specific 386 that is).
- w4rh4wk5 3y agoProductivity gap at its finest ^^
- 0xbadcafebee 3y agoyou joke, but it's the most powerful promotion technique. create something insanely efficient but still provides business value, and then spend 2-3 years "increasing efficiency" and publicizing it, then get promoted because you're so great at efficiency, repeat. "I saved $20,000 with this one neat trick!" (neat trick: turn off the servers you don't need)
- marcusjt 3y agoPresumably you meant to say "insanely inefficient"?
- derefr 3y agoNo, that's kind of the trick of it. To be able to do this, the thing you create has to be, on a base level, insanely efficient compared to what came before. You're frontloading years of optimizations in one big leap. On top of that solid basis, you can introduce artificial inefficiencies, and then gradually remove them. But you can't do the trick at all, if your rewrite doesn't start off being an orders-of-magnitude efficiency improvement.
- 0xbadcafebee 3y agoyes :)
- alberth 3y agoOr you become known as the person who ships slow/laggy products.
- dabluecaboose 3y agoI actually pulled the reverse of this at my last job. Surprisingly, a lot of aerospace engineers are not super computer-literate. We used a clunky maneuver planning software for the geostationary sats that spit out our plans in an ASCII printout, which we then had to copy/paste out and manipulate using several consecutive shell scripts. I got annoyed doing it and so I rewrote the whole deal in Python, and just had it locate the file that had the printout. When I first ran it, it had turned a 3-4 hour affair into about 10 minutes (depending on network connectivity). I showed it to my boss, and he was asking why it said "working...done" instantly. He said it looked like it wasn't doing anything. So I added an aesthetic wait variable to the config and made it 1.25 seconds. So the user got to see "Working..." and then "done" would pop out, making it seem more like it was actually doing things to the layperson. Last I heard they were still using that script for maneuver planning to this day.
- pixl97 3y agoI mean, honestly having the pause, or some other conformation that work was completed is useful. If you ever had a system 'fail successfully', finishing to fast does become a concern.
- p4l4g4 3y agoHaving meaningful output is useful, artificial pauzes like this are only for dramatic effect. I rather have a linear, timestamped log, so I can confirm my suspicions, than a progress bar with artificial delays, that suggest progress. But that's the techy point of view. Most non-techies will probably prefer feel over functionality. I think most people do. If something is instant, it feels too good to be true. If something takes ages, you'll get bored or frustrated. While things that take a proportional amount of time feel satisfying.
- jareklupinski 3y agowhen they ask for stuff like that, what they really want is more juice https://garden.bradwoods.io/notes/design/juice https://garden.bradwoods.io/notes/design/juice "..." is a kind of juice
- mixmastamyk 3y agoKirk: Mr. Scott. Have you always multiplied your repair estimates by a factor of four? Scott: Certainly, sir. How else can I keep my reputation as a miracle worker? Kirk: Your reputation is secure, Scotty.
- interlinked 3y agoany guesses about how soon this will be available in distributions like pop os?
- dogleash 3y agoHow often does your distro update the kernel? Does your distro ship stable or an LTS kernel? Will this patch even get backported into LTS kernels? How often does your distro cut new disto releases? tl;dr: I think pop is a Ubuntu flavor, so ~6 months and/or it's already available today if you're not afraid to compile your own kernel.
- Shared404 3y ago> tl;dr: I think pop is a Ubuntu flavor, so ~6 months and/or it's already available today if you're not afraid to compile your own kernel Pop isn't currently following the Ubuntu release cadence, they've got some internal development that their focusing on instead currently.
- zamalek 3y agoYou'll probably spend more time setting up bleeding edge kernel PPAs and what-have-you than this will save you. If "when will I get?" is ever a question for you, then an Ubuntu-based distro is probably the wrong choice: Ubuntu is about stability, not features.
- jeroenhd 3y agoWhile this is true, they do occasionally backport some stuff from newer kernels (usually for security reasons). This looks like a reasonably easy-to-backport patch, assuming the code hasn't been refactored since Ubuntu pinned their kernel version for a release of choice.
- PrimeMcFly 3y agoWhen did this change? I remember the opposite being true, i.e. jumping on Wayland, PulseAudio when it still had issues, etc.
- arnon 3y agoI'm not sure what news value this has - what is there to talk about?
- consp 3y agoGood to see general resume improvements but ... Can we not try to force s2idle? It uses way too much power. I've not yet seen a laptop which is capable of staying "sleeping" in s2idle as long as in s3 sleep. Correct me if I'm wrong though. I also don't really get why: s3 is more than fast enough to be awake when my laptop is open and I'm ready to login, the only "need to be faster" way I can see is when you do not lock you laptop and go straight to desktop but that has ... issues.
- tpxl 3y agoCan I get my S4 back? I've never had issues with it, as opposed to constant S2/3 issues, and the startup is still faster than having to look for a cable because S2/S3 managed to drain all the battery.
- aimor 3y agoWhat is the current situation with sleep states? I've been seeing lots of conversations the last two years and I just don't have a big level picture of why it's such an issue now. I only use S4 (hibernate) because I can ignore my laptop for weeks at a time, unplugged, and jump right back in to where I left off. Microsoft seems to have changed some things in Windows to hide the hibernate option for some reason I can't figure out.
- secondcoming 3y agoHibernate isn't great if you have lots of RAM. Windows won't allow you put the hiberfil.sys anywhere other than C:\. I was confused as to why my C: SSD appeared full until I figured it was because of hibernation (I have 128GB RAM).
- jeroenhd 3y agoIt's a shame hyberfil.sys can't be moved, but as I understand it, the reason behind it is that the kernel only has an extremely rudimentary NTFS driver at the point it resumes so I don't think it'll change soon. That said, with modern SSD prices I think the size it takes up is quite reasonable these days. For a while, when people were running 64GiB SSDs, the situation was a lot worse.
- samsquire 3y agoI've been thinking there must be a generic approach to waiting for events rather than sleeping and registering actions on events. Like epoll for events
- programmarchy 3y agoIt may be a "one-liner", but it's the kind where the engineer had to have broad and detailed knowledge about the system and how it works. Well done!
- kevincox 3y agoThe classic: 1. Doing the thing $5/h 2. Knowing what thing to do $500/h
- greiskul 3y agoYup. One of the most complex bug I ever fixed was caused by a race condition. It took me 2 weeks to investigate and fix it. The final result was a couple of lines (like 5).
- hexo 3y agoHow much have you been paid for it? $4k? I'd be brutally laughed at in this "awesome" country for that. Some just cannot understand it. How do you get them actually pay for that time? Thats a mystery for me.
- tracker1 3y agoHad dealt with a similar issue, as well as an issue where all configuration variables was loaded from a database into an in-memory table, and that table was queried with a sql-like structure like a thousand times over a single web request stack (login request was like 25-30s). I swapped it out with a hash table, and that knocked the login request to under 10s, and 9.5s of that was an external system outside my control. On the race condition, that was actually pretty easy to diagnose and solve, replaced the static property with a local getter/setter using the request context to store the value (asp.net 2.0).
- nonethewiser 3y agoSo many bugs are like this. Spend 1 or 2 days on it and then ship a 1 line change.
- nightowl_games 3y agoI just upgraded my Linux kernel and had major suspend issues due to the XHCI driver. I ended up having to disable the ability for XHCI to wake my machine. On fedora cinnamon, I was getting random freezes on resume, and momentary freezes on resume on Linux Mint. Disabling the ability for XHCI to wake my machine fixed it. This sleep() looks like bad code designed to work around a race condition. Perhaps it's related to the issue I had. This issue was the worst Linux issue I've had in ~10+ years. (I'm on ryzen first gen cpu)
- hiyer 3y agoI'm having similar issue with my Ryzen laptop. May I know what you had to change to disable XHCI wakeup?
- nightowl_games 3y agoThankfully, I have a repo of all the little configs and scripts I have used. You can do cat /proc/acpi/wakeup to see what is allowed to wake your machine. Echoing the device ID into /proc/acpi/wakeup will toggle it between disabled and enabled. So to disable XHCI wakeup, I had to do: sudo echo XHC0 > /proc/acpi/wakeup Now that will reset on every boot, so I wrote a systemd service to do it on startup, and instead of just disabling 'XCH0', I found another user online that had written a shell script to disable everything's ability to wake the machine. This is the systemd unit to disable the ability for devices to wake the machine: https://github.com/jknightdoeswork/dotfiles/blob/master/disable_acpi_wake.service https://github.com/jknightdoeswork/dotfiles/blob/master/disa... This is the shell script to install that systemd unit so it runs on every boot: https://github.com/jknightdoeswork/dotfiles/blob/master/install_disable_acpi_wake_service.sh https://github.com/jknightdoeswork/dotfiles/blob/master/inst... Note that with this installed, I'm pretty sure the only way to wake your machine is to press the power button. I prefer that but you might not. You may want to disable _just_ the XHCI devices, not _all_ of em. Up to you. Feel free to ask more questions.