Bug 34936 - Please don't run disk-spin-up-avoidance hooks on non-rotational devices (such as SSDs)
Summary: Please don't run disk-spin-up-avoidance hooks on non-rotational devices (such...
Status: RESOLVED WONTFIX
Alias: None
Product: pm-utils
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 11:38 UTC by Josh Triplett
Modified: 2018-06-29 19:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to disable spinup-avoidance hooks if no rotational devices present (2.54 KB, patch)
2011-04-22 12:58 UTC, Josh Triplett
Details | Splinter Review

Description Josh Triplett 2011-03-02 11:38:54 UTC
I currently have pm-utils 1.3.0 installed.  Looking ahead in the changelog, I saw:

    Current hooks when switching to battery:
[...]
    - [harddrive] More aggressive harddrive spindown times
[...]
    - [journal-commit, xfs_buffer] Delay ext[34]/ext journal/metadata
      writeback
    - [laptop-mode] Delay hard disk writeback times of dirty caches, to avoid
      spin ups

(Later versions may not necessarily enable the harddrive hook, at least in the Debian package.)

In general, this seems like a bad idea to do automatically without the
user's knowledge; it makes the system far less robust against sudden
failures.  I haven't worried about losing data due to a system crash
(usually self-inflicted due to kernel hacking) in a long time.  I don't
want to have to start now.

But in any case, none of these hooks need to run on a non-rotational
device such as an SSD.  SSDs can idle very effectively the moment they
have no work to do, without a long spin-up/spin-down transition.  So,
you don't need to make the system less safe to minimize spin-ups on
such systems.  Delaying "spin-up" on an SSD doesn't actually lead to power savings, but it still increases the risk of data loss.

You can detect non-rotational devices by looking at
/sys/block/$device/queue/rotational , which will contain a 1
(rotational) or 0 (non-rotational such as an SSD).  For instance, on my
system:

~$ cat /sys/block/sda/queue/rotational
0

(Note that these files only exist for the top-level devices like sda,
not partition devices like sda1.)

So, if you see rotational -eq 0 on a device, you shouldn't run the
harddrive, journal-commit, xfs_buffer, or laptop-mode hooks for the
filesystems on that device.

(I'd argue more generally against running those hooks on *any* device,
but this seems like the right place to start, and it solves my immediate
problem. :) )

Originally reported as http://bugs.debian.org/612950 .
Comment 1 Josh Triplett 2011-04-22 12:58:26 UTC
Created attachment 45967 [details] [review]
Patch to disable spinup-avoidance hooks if no rotational devices present

I've attached a patch implementing this request; with this patch, the spinup-avoidance hooks exit $NA if the system has no rotational disks.
Comment 2 Bryce 2011-06-01 12:02:05 UTC
Agreed.  SSDs will use no additional power if you write right away.
Comment 3 Kan-Ru Chen 2011-06-21 18:35:18 UTC
(In reply to comment #1)
> Created an attachment (id=45967) [details]
> Patch to disable spinup-avoidance hooks if no rotational devices present
> 
> I've attached a patch implementing this request; with this patch, the
> spinup-avoidance hooks exit $NA if the system has no rotational disks.

On my system the dm-crypt device always reports rotational:

  dm-0/queue/rotational:1
  dm-1/queue/rotational:1
  sda/queue/rotational:0
Comment 4 Josh Triplett 2011-06-21 19:03:05 UTC
On Tue, Jun 21, 2011 at 06:35:18PM -0700, bugzilla-daemon@freedesktop.org wrote:
> https://bugs.freedesktop.org/show_bug.cgi?id=34936
> 
> --- Comment #3 from Kan-Ru Chen <kanru@kanru.info> 2011-06-21 18:35:18 PDT ---
> (In reply to comment #1)
> > Created an attachment (id=45967)
>  View: https://bugs.freedesktop.org/attachment.cgi?id=45967
>  Review: https://bugs.freedesktop.org/review?bug=34936&attachment=45967
> 
> > Patch to disable spinup-avoidance hooks if no rotational devices present
> > 
> > I've attached a patch implementing this request; with this patch, the
> > spinup-avoidance hooks exit $NA if the system has no rotational disks.
> 
> On my system the dm-crypt device always reports rotational:
> 
>   dm-0/queue/rotational:1
>   dm-1/queue/rotational:1
>   sda/queue/rotational:0

Same here, on 2.6.39.  That seems like a kernel bug; dm devices should
inherit the rotational property from the device(s) that contain them.

- Josh Triplett
Comment 5 Adam Jackson 2018-06-29 19:57:15 UTC
pm-utils hasn't been touched in eight years, none of this is likely to get addressed. Closing bugs and disabling the bz product.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.