From owner-svn-src-all@freebsd.org Sun Aug 27 05:14:49 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 4A09ADE79C2; Sun, 27 Aug 2017 05:14:49 +0000 (UTC) (envelope-from cem@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 1966C65B54; Sun, 27 Aug 2017 05:14:49 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7R5Emw5064786; Sun, 27 Aug 2017 05:14:48 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7R5EmDK064785; Sun, 27 Aug 2017 05:14:48 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201708270514.v7R5EmDK064785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 27 Aug 2017 05:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322942 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322942 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, 27 Aug 2017 05:14:49 -0000 Author: cem Date: Sun Aug 27 05:14:48 2017 New Revision: 322942 URL: https://svnweb.freebsd.org/changeset/base/322942 Log: Improve scheduler performance Improve scheduler performance by flattening nonsensical topology layers (layers with only one child don't serve any purpose). This is especially relevant on non-AMD Zen systems after r322776. On my dual core Intel laptop, this brings the kern.sched.topology_spec table down from three levels to two. Submitted by: jeff Reviewed by: attilio Sponsored by: Dell EMC Isilon Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Aug 27 03:10:16 2017 (r322941) +++ head/sys/kern/subr_smp.c Sun Aug 27 05:14:48 2017 (r322942) @@ -630,6 +630,15 @@ smp_topo(void) panic("Built bad topology at %p. CPU mask (%s) != (%s)", top, cpusetobj_strprint(cpusetbuf, &top->cg_mask), cpusetobj_strprint(cpusetbuf2, &all_cpus)); + + /* + * Collapse nonsense levels that may be created out of convenience by + * the MD layers. They cause extra work in the search functions. + */ + while (top->cg_children == 1) { + top = &top->cg_child[0]; + top->cg_parent = NULL; + } return (top); }