lkml.org 
[lkml]   [2019]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3] PM / suspend: measure the time of filesystem syncing
On Wed, Feb 20, 2019 at 5:44 PM Pan, Harry <harry.pan@intel.com> wrote:
>
> Thanks for comments.
>
> > > + if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC)) {
> > > + ktime_t start;
> > > + unsigned int elapsed_msecs;
> > > +
> > > + trace_suspend_resume(TPS("sync_filesystems"), 0, true);
> > > + pr_info("Syncing filesystems ... ");
> > > + start = ktime_get();
> > > + ksys_sync();
> > > + elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(),
> > > start));
> > > + pr_cont("(elapsed %d.%03d seconds) done.\n",
> > > + elapsed_msecs / MSEC_PER_SEC,
> > > + elapsed_msecs % MSEC_PER_SEC);
> >
> > One more nit.
> >
> > Since you are printing the sync time anyway, there is a little sense
> > to
> > split the message using pr_cont() that may be messed up with by any
> > intervening messages, so why don't you just print a one-line
> > pr_info("Filesystems sync: %d.%03d seconds\n", ...) message?
> >
> Yes, I agree.
> In practical, I did see intervening messages (between pr_info and
> pr_cont) when it came to long sync in kernel.
> I was hesitated in this considering not fully understanding the
> backdrop of split messages using pr_info() then pr_cont().
>
> > Also, if you change it here, I guess it would be consistent to make
> > an analogous change for hibernation.
>
> One potential last-mile need your wisdom, which is about the switch
> case of SNAPSHOT_FREEZE of the userspace interface you wrote.
> I am yet to touch it, nor understand how to validate it.

Why don't you add a "sync" helper function in main.c with the timing
and message that will be called from hibernate.c, user.c and suspend.c
(in the last one conditional on
!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC))?

That would reduce some code duplication nicely.

\
 
 \ /
  Last update: 2019-02-20 22:46    [W:0.061 / U:28.520 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site