From owner-svn-src-all@freebsd.org Sun Sep 17 06:32:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E531E26AB5; Sun, 17 Sep 2017 06:32:06 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D7DA744AD; Sun, 17 Sep 2017 06:32:06 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8H6W514094738; Sun, 17 Sep 2017 06:32:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8H6W50x094737; Sun, 17 Sep 2017 06:32:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201709170632.v8H6W50x094737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 17 Sep 2017 06:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323666 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/usr.bin/netstat X-SVN-Commit-Revision: 323666 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Sep 2017 06:32:06 -0000 Author: bapt Date: Sun Sep 17 06:32:05 2017 New Revision: 323666 URL: https://svnweb.freebsd.org/changeset/base/323666 Log: MFC r323016: Don't call kresolv_list() if using netstat on live kernel kresolve_list() is calling many kldsym(2). Removing that call on when collecting stats for the running kernel improves the startup time and CPU usage. Submitted by: Nikita Kozlov (nikita.kozlov@blade-group.com) Reviewed by: cem Sponsored by: blade Differential Revision: https://reviews.freebsd.org/D12151 Modified: stable/11/usr.bin/netstat/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/main.c ============================================================================== --- stable/11/usr.bin/netstat/main.c Sun Sep 17 04:15:12 2017 (r323665) +++ stable/11/usr.bin/netstat/main.c Sun Sep 17 06:32:05 2017 (r323666) @@ -422,13 +422,12 @@ main(int argc, char *argv[]) if (!live) { if (setgid(getgid()) != 0) xo_err(-1, "setgid"); + /* Load all necessary kvm symbols */ + kresolve_list(nl); } if (xflag && Tflag) xo_errx(1, "-x and -T are incompatible, pick one."); - - /* Load all necessary kvm symbols */ - kresolve_list(nl); if (Bflag) { if (!live)