linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Ming Lei <tom.leiming@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Dave Chinner <david@fromorbit.com>, Len Brown <lenb@kernel.org>,
	Linux PM List <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 1/1] suspend: delete sys_sync()
Date: Mon, 18 May 2015 11:57:27 +1000	[thread overview]
Message-ID: <20150518115727.72439610@notabene.brown> (raw)
In-Reply-To: <20150515113557.54ef930b@lxorguk.ukuu.org.uk>

[-- Attachment #1: Type: text/plain, Size: 3853 bytes --]

On Fri, 15 May 2015 11:35:57 +0100 One Thousand Gnomes
<gnomes@lxorguk.ukuu.org.uk> wrote:

> > > Data loss may be caused for hotplug storage(like USB), or all storage
> > > when power is exhausted during suspend.
> > 
> > Which also may very well happen at run time, right?
> 
> Intuitively users treat "suspended" as a bit like off and do remove
> devices they've "finished with".
> 
> Technically yes the instant off/on on a phone is the same as the suspend
> to RAM on a laptop but it doesn't mean the model in people's heads is the
> same... not yet anyway.
> 
> > > Is there obvious advantage to remove sys_sync() in the case?
> > 
> > Yes, there is.  It is not necessary to sync() every time you suspend
> > if you do that very often.
> 
> But if you do it very often you won't have any dirty pages to flush so it
> will be very fast.

Several people have said things like this, and yet Len clearly saw a problem
so sometimes it isn't as fast as you think it should be.  I guess we need
some data.

In fact there seem to be a number of open questions:

1/ Len has seen enough delays to bother sending a patch.  Twice.  Lots of
   other people claim there shouldn't be much delay.

   Len: can you provide numbers?  How long does the sys_sync take
   (min/max/mean....).  I think an interesting number would be in a quick
   "resume, do something, suspend" cycle, what percent of the time is spent
   in sys_sync.
   Maybe also report what filesystems are in use, and whether you expect
   there to be any dirty data.

   If I run "time sync; time sync; time sync" it reports about 50msec for
   each sync.  If I run "time sleep 0; time sleep 0; time sleep 0" it reports
   about 2 msec.  So sys_sync is taking at least 50msec.
   Almost all of that is in sync_inodes_sb() and much of that is in
   _raw_spin_lock.... though I might be misinterpreting perf.  It seems to
   wait for a BDI flusher thread to go off and do nothing.

   Len: is 50msec enough to bother you?


2/ Is a 'sys_sync' really necessary.  People claim that "users might lose
   data".  I claim that some user data could be still in the application
   buffers so they would lose that anyway, and applications call fsync after
   writing everything out, so sys_sync isn't necessary.
   Does anyone have an example of an application which writes important
   user data, but doesn't call "fsync" shortly after all data has been written
   out of the application's internal buffers?

3/ Is a 'sys_sync' sufficient.  Len claims that in some cases, when running
     sync; sync
   the second sync takes longer, suggesting that the first sync didn't do
   everything that was expected.   Prior to Linux 1.3.20, sys_sync didn't
   wait for everything.  Since then it seems to be designed to, but maybe
   something isn't right there.
   In that case, having sys_sync may not be helping anyway.

   Len: can you reliably reproduce this?  Can you provide a recipe?

4/ Which part of 'sync' is really important?
   sys_sync does two things.  It initiates writeout on dirty data and it
   wait for writeout to complete.  Even if the former isn't necessary, the
   latter probably is.  Do we need to reliably wait for all output queues
   to flush?  Where is the best place to do that?

Thanks,
NeilBrown



> 
> > And it is done in such a place that everything needs to wait for it to complete.
> 
> Only because the code deciding to trigger any automated suspend doesn't
> do a sync a few seconds before. In the case the user goes to the menus
> and does power->suspend then yes it's a delay. In the case where the OS
> at some level has decided that it's 10 seconds from automatically
> suspending to something the user space can issue a pre-emptive sync to
> get the queue size down.
> 
> Alan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-05-18  1:57 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  7:08 [PATCH 1/1] suspend: delete sys_sync() Len Brown
2015-05-08 14:34 ` Alan Stern
2015-05-08 16:36   ` Len Brown
2015-05-08 19:13     ` One Thousand Gnomes
2015-05-08 19:32       ` Len Brown
2015-05-08 19:52         ` One Thousand Gnomes
2015-05-08 20:39           ` Rafael J. Wysocki
2015-05-08 20:30         ` Rafael J. Wysocki
2015-05-09 19:59           ` Alan Stern
2015-05-09 20:25             ` Henrique de Moraes Holschuh
2015-05-11 20:34               ` Len Brown
2015-05-12  6:11                 ` Oliver Neukum
2015-06-25 17:11                 ` Henrique de Moraes Holschuh
2015-06-30 20:04                   ` Len Brown
2015-07-01 12:21                     ` Henrique de Moraes Holschuh
2015-07-02  3:07                       ` Len Brown
2015-07-03  1:42                         ` Dave Chinner
2015-07-04  1:03                           ` Rafael J. Wysocki
2015-07-04  8:50                             ` Geert Uytterhoeven
2015-07-05 23:25                               ` Rafael J. Wysocki
2015-07-04 14:19                             ` Alan Stern
2015-07-05 23:28                               ` Rafael J. Wysocki
2015-07-06 11:06                                 ` Pavel Machek
2015-07-06 13:59                                   ` Rafael J. Wysocki
2015-07-07 10:25                                     ` Pavel Machek
2015-07-07 12:22                                       ` Rafael J. Wysocki
2015-07-06  0:06                             ` Dave Chinner
2015-07-06 11:11                               ` Pavel Machek
2015-07-06 13:52                               ` Rafael J. Wysocki
2015-07-07  1:17                                 ` Dave Chinner
2015-07-07 12:14                                   ` Rafael J. Wysocki
2015-07-07 13:16                                     ` Oliver Neukum
2015-07-07 14:32                                       ` Rafael J. Wysocki
2015-07-07 14:38                                         ` Oliver Neukum
2015-07-07 15:03                                           ` Alan Stern
2015-07-07 22:20                                             ` Rafael J. Wysocki
2015-07-08 11:20                                               ` Pavel Machek
2015-07-08 14:40                                                 ` Alan Stern
2015-07-08 22:04                                                   ` Rafael J. Wysocki
2015-07-07 22:11                                           ` Rafael J. Wysocki
2015-07-08  7:51                                             ` Oliver Neukum
2015-07-08 22:03                                               ` Rafael J. Wysocki
2015-07-09  7:32                                                 ` Oliver Neukum
2015-07-09 23:22                                                   ` Rafael J. Wysocki
2015-08-04 19:54                                                     ` Pavel Machek
2015-07-08 11:17                                         ` Pavel Machek
2015-07-07 13:42                                   ` Takashi Iwai
2015-07-06 10:15                             ` Ming Lei
2015-07-06 10:03           ` Pavel Machek
2015-05-11  1:44 ` Dave Chinner
2015-05-11 20:22   ` Len Brown
2015-05-12 22:34     ` Dave Chinner
2015-05-13 23:22   ` NeilBrown
2015-05-14 23:54     ` Dave Chinner
2015-05-15  0:34       ` Rafael J. Wysocki
2015-05-15  0:40         ` Ming Lei
2015-05-15  0:59           ` Rafael J. Wysocki
2015-05-15  5:13             ` Ming Lei
2015-05-15 10:35             ` One Thousand Gnomes
2015-05-18  1:57               ` NeilBrown [this message]
     [not found]                 ` <CAJvTdKn_0EZ0ZuqO2e4+ExD8kFWcy78fse4zHr3uFZODOroXEg@mail.gmail.com>
2015-06-19  1:09                   ` Dave Chinner
2015-06-19  2:35                     ` Len Brown
2015-06-19  4:31                       ` Dave Chinner
2015-06-19  6:34                         ` Len Brown
2015-06-19 23:07                           ` Dave Chinner
2015-06-20  5:26                             ` Len Brown
2015-05-15  1:04       ` NeilBrown
2015-05-15 14:20         ` Alan Stern
2015-05-15 14:32           ` Alan Stern
2015-05-15 14:19       ` Alan Stern
2015-07-06 10:07   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150518115727.72439610@notabene.brown \
    --to=neilb@suse.de \
    --cc=david@fromorbit.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).