Re: [PATCH 1/1] suspend: delete sys_sync()

From: NeilBrown
Date: Wed May 13 2015 - 19:23:10 EST


On Mon, 11 May 2015 11:44:28 +1000 Dave Chinner <david@xxxxxxxxxxxxx> wrote:

> On Fri, May 08, 2015 at 03:08:43AM -0400, Len Brown wrote:
> > From: Len Brown <len.brown@xxxxxxxxx>
> >
> > Remove sys_sync() from the kernel's suspend flow.
> >
> > sys_sync() is extremely expensive in some configurations,
> > and so the kernel should not force users to pay this cost
> > on every suspend.
>
> Since when? Please explain what your use case is that makes this
> so prohibitively expensive it needs to be removed.
>
> >
> > The user-space utilities s2ram and s2disk choose to invoke sync() today.
> > A user can invoke suspend directly via /sys/power/state to skip that cost.
>
> So, you want to have s2disk write all the dirty pages in memory to
> the suspend image, rather than to the filesystem?
>
> Either way you have to write that dirty data to disk, but if you
> write it to the suspend image, it then has to be loaded again on
> resume, and then written again to the filesystem the system has
> resumed. This doesn't seem very efficient to me....
>
> And, quite frankly, machines fail to resume from suspne dall the
> time. e.g. run out of batteries when they are under s2ram
> conditions, or s2disk fails because a kernel upgrade was done before
> the s2disk and so can't be resumed. With your change, users lose all
> the data that was buffered in memory before suspend, whereas right
> now it is written to disk and so nothing is lost if the resume from
> suspend fails for whatever reason.
>
> IOWs, I can see several good reasons why the sys_sync() needs to
> remain in the suspend code. User data safety and filesystem
> integrity is far, far more important than a couple of seconds
> improvement in suspend speed....

To be honest, this sounds like superstition and fear, not science and fact.

"filesystem integrity" is not an issue for the fast majority of filesystems
which use journalling to ensure continued integrity even after a crash. I
think even XFS does that :-)

For those few toy filesystems which don't journal, like VFAT and ..... well,
VFAT, it may well make sense for VFAT to request a notification on suspend
and to do whatever is needed to ensure consistent on-storage structures.

"User data safety" is not very closely related to "sys_sync". That call
doesn't tell my emacs or my libre-office that now is a good time to auto-save.
All that "sys_sync" saves is data that has been written-but-not-fsynced.
That is only a small portion of "user data" and anyone who thinks it is
"safe" is already deluded (possibly deluded by over-exposure to ext3).

I am very much in favour of Len's patch. Not only does the sys_sync()
call have a real cost, but I believe it also has zero value.

Can you identify an actual case where the removal of sys_sync would introduce
a measurable cost?

NeilBrown

Attachment: pgpSQHNejZ82W.pgp
Description: OpenPGP digital signature