Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2022 09:49:03 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4003cdd81b87 - stable/13 - loader: ip: Do not call getsecs so much
Message-ID:  <202201130949.20D9n3gW095873@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=4003cdd81b8776cb451395ffa53423ad52328bc9

commit 4003cdd81b8776cb451395ffa53423ad52328bc9
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-12-09 14:46:39 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-01-13 07:56:00 +0000

    loader: ip: Do not call getsecs so much
    
    getsecs is very costly, reuse the values we got before.
    
    Fetching a ~30MB kernel with the tftp command use to take ~26 seconds
    and now it's ~18 seconds.
    
    Reviewed by:    imp, tsoome
    MFC after:      2 weeks
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D33408
    
    (cherry picked from commit c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d)
---
 stand/libsa/net.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/stand/libsa/net.c b/stand/libsa/net.c
index 3142616a5bf0..e04a370e466e 100644
--- a/stand/libsa/net.c
+++ b/stand/libsa/net.c
@@ -101,10 +101,9 @@ sendrecv(struct iodesc *d,
 	tmo = MINTMO;
 	tlast = 0;
 	tleft = 0;
-	tref = getsecs();
-	t = getsecs();
+	tref = t = getsecs();
 	for (;;) {
-		if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) {
+		if (MAXWAIT > 0 && (t - tref) >= MAXWAIT) {
 			errno = ETIMEDOUT;
 			return -1;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201130949.20D9n3gW095873>