mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zihuan Zhang <zhangzihuan@kylinos.cn>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] PM: suspend: clean up redundant filesystems_freeze/thaw handling
Date: Wed, 16 Jul 2025 10:04:32 +0800	[thread overview]
Message-ID: <79468a7f-061f-479a-9357-e48c69cadbb8@kylinos.cn> (raw)
In-Reply-To: <CAJZ5v0jKwHZUpsYLzUkcL4=FDnewXoTeJo5e+ccyHw2bZ+ghTg@mail.gmail.com>


在 2025/7/15 20:48, Rafael J. Wysocki 写道:
> On Tue, Jul 15, 2025 at 8:12 AM Zihuan Zhang <zhangzihuan@kylinos.cn> wrote:
>> Hi Rafael,
>>
>> 在 2025/7/15 01:57, Rafael J. Wysocki 写道:
>>> Hi,
>>>
>>> On Mon, Jul 14, 2025 at 10:44 AM Zihuan Zhang <zhangzihuan@kylinos.cn> wrote:
>>>> Hi Rafael,
>>>>
>>>> Just a gentle ping on this patch.
>>> I've lost track of it for some reason, sorry.
>>>
>>>> I realized I forgot to mention an important motivation in the changelog:
>>>> calling filesystems_freeze() twice (from both suspend_prepare() and
>>>> enter_state()) lead to a black screen and make the system unable to resume..
>>>>
>>>> This patch avoids the duplicate call and resolves that issue.
>>> Now applied as a fix for 6.16-rc7, thank you!
>>
>> Thanks for the reply!
>>
>> Just a quick follow-up question — we noticed that even when the “freeze
>> filesystems” feature is not enabled, the current code still calls
>> filesystems_thaw().
>>
>> Do you think it would make sense to guard this with a static key (or
>> another mechanism) to avoid unnecessary overhead?
> Possibly, if this overhead is significant, but is it?

We've done some testing using ftrace to measure the overhead of 
filesystems_thaw(). When freeze_filesystems is not enabled, the overhead 
is typically around 15–40 microseconds.

However, when freeze is enabled, we observed that filesystems_thaw() can 
take over 3 seconds to complete (e.g., 3,450,644 us in one test case).

freeze_filesystems  not enabled:

# tracer: function_graph
#
# CPU  DURATION                  FUNCTION CALLS
# |     |   |                     |   |   |   |
   4) + 15.740 us   |  filesystems_thaw();
  11) + 16.894 us   |  filesystems_thaw();
  10) + 17.805 us   |  filesystems_thaw();
   8) + 37.762 us   |  filesystems_thaw();
  ------------------------------------------
  11) systemd-54512  => systemd-66433
  ------------------------------------------

  11) + 15.167 us   |  filesystems_thaw();
   6) + 16.760 us   |  filesystems_thaw();
   7) + 14.870 us   |  filesystems_thaw();
   3) + 16.171 us   |  filesystems_thaw();
   1) + 16.461 us   |  filesystems_thaw();
  ------------------------------------------
   3) systemd-71984  => systemd-73036
  ------------------------------------------

   3) + 28.314 us   |  filesystems_thaw();

freeze_filesystems  enabled:

  10)               |  filesystems_thaw() {
   2) $ 3450644 us  |  } /* filesystems_thaw */
  ------------------------------------------
   1) systemd-72561  => systemd-99210
  ------------------------------------------

   1)               |  filesystems_thaw() {
  ------------------------------------------
   7) systemd-71501  => systemd-99210
  ------------------------------------------

   7) $ 3429306 us  |  } /* filesystems_thaw */
  ------------------------------------------
   7) systemd-99210  => systemd-100028
  ------------------------------------------

   7)               |  filesystems_thaw() {
  ------------------------------------------
   4) systemd-53278  => systemd-100028
  ------------------------------------------

   4) $ 3270122 us  |  } /* filesystems_thaw */
  ------------------------------------------
   7) systemd-100028 => systemd-100720
  ------------------------------------------

   7) $ 3446496 us  |  filesystems_thaw();
  ------------------------------------------
   7) systemd-100720 => systemd-112075
  ------------------------------------------

   7)               |  filesystems_thaw() {
  ------------------------------------------
  11) systemd-66433  => systemd-112075
  ------------------------------------------

  11) $ 3454117 us  |  } /* filesystems_thaw */



  reply	other threads:[~2025-07-16  2:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-12  3:08 Zihuan Zhang
2025-07-14  8:44 ` Zihuan Zhang
2025-07-14 17:57   ` Rafael J. Wysocki
2025-07-15  6:12     ` Zihuan Zhang
2025-07-15 12:48       ` Rafael J. Wysocki
2025-07-16  2:04         ` Zihuan Zhang [this message]
2025-07-16 12:23           ` Rafael J. Wysocki
2025-07-17  0:37             ` Zihuan Zhang

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=79468a7f-061f-479a-9357-e48c69cadbb8@kylinos.cn \
    --to=zhangzihuan@kylinos.cn \
    --cc=brauner@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /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

all inboxes | Powered by JetHome®