mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zhoumin <teczm@foxmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Arjan van de Ven <arjan@linux.intel.com>,
	teczm@foxmail.com
Subject: [PATCH] async: Use ktime_us_delta() for debug timings
Date: Tue, 27 Oct 2026 20:01:12 +0800	[thread overview]
Message-ID: <tencent_58D610F93574D60C9AE734253AF69A528506@qq.com> (raw)

Replace microseconds_since() with ktime_us_delta() for accurate
microsecond timings.

Fixes: 22a9d645677f ("async: Asynchronous function calls to speed up kernel boot")
Signed-off-by: zhoumin <teczm@foxmail.com>
---
 kernel/async.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/async.c b/kernel/async.c
index 0e3a783dc991..e8862c39344b 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -80,12 +80,6 @@ static DECLARE_WAIT_QUEUE_HEAD(async_done);
 
 static atomic_t entry_count;
 
-static long long microseconds_since(ktime_t start)
-{
-	ktime_t now = ktime_get();
-	return ktime_to_ns(ktime_sub(now, start)) >> 10;
-}
-
 static async_cookie_t lowest_in_progress(struct async_domain *domain)
 {
 	struct async_entry *first = NULL;
@@ -130,7 +124,7 @@ static void async_run_entry_fn(struct work_struct *work)
 
 	pr_debug("initcall %lli_%pS returned after %lld usecs\n",
 		 (long long)entry->cookie, entry->func,
-		 microseconds_since(calltime));
+		 ktime_us_delta(ktime_get(), calltime));
 
 	/* 2) remove self from the pending queues */
 	spin_lock_irqsave(&async_lock, flags);
@@ -317,7 +311,7 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain
 	wait_event(async_done, lowest_in_progress(domain) >= cookie);
 
 	pr_debug("async_continuing @ %i after %lli usec\n", task_pid_nr(current),
-		 microseconds_since(starttime));
+		 ktime_us_delta(ktime_get(), starttime));
 }
 EXPORT_SYMBOL_GPL(async_synchronize_cookie_domain);
 

base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
-- 
2.53.0


             reply	other threads:[~2026-10-27 12:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 12:01 zhoumin [this message]
2026-10-27 13:28 ` Arjan van de Ven

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=tencent_58D610F93574D60C9AE734253AF69A528506@qq.com \
    --to=teczm@foxmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=tj@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®