freebsd-skq/sys
bdrewery a175970362 Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.

Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation.  This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang.  (It appears that ICC also supports this but I
do not have access to test it).  This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'.  This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.

For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected.  In time this may change but for now
I've been conservative.  The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant.  For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.

A .depend file is still generated with the various rules that apply to
the final target, or custom rules.  Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o.  These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.

Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.

The -M flags are removed from CFLAGS when linking since they have no effect.

Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.

The system I used for testing was:
  WITNESS
  Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
  DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
        The arc was fully populated with src tree files.
  RAM: 76GiB
  CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
       2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16

buildworld:
  x buildworld-before
  + buildworld-fastdep
  +-------------------------------------------------------------------------------+
  |+                                                                              |
  |+                                                                              |
  |+                                                                       xx    x|
  |                                                                       |_MA___||
  |A                                                                              |
  +-------------------------------------------------------------------------------+
      N           Min           Max        Median           Avg        Stddev
  x   3       3744.13       3794.31       3752.25     3763.5633     26.935139
  +   3       3153.34       3155.16        3154.2     3154.2333    0.91045776
  Difference at 95.0% confidence
          -609.33 +/- 43.1943
          -16.1902% +/- 1.1477%
          (Student's t, pooled s = 19.0569)

buildkernel:
  x buildkernel-before
  + buildkernel-fastdep
  +-------------------------------------------------------------------------------+
  |+                                                                            x |
  |++                                                                           xx|
  |                                                                             A||
  |A|                                                                             |
  +-------------------------------------------------------------------------------+
      N           Min           Max        Median           Avg        Stddev
  x   3        571.57        573.94        571.79     572.43333     1.3094401
  +   3        369.12        370.57         369.3     369.66333    0.79033748
  Difference at 95.0% confidence
          -202.77 +/- 2.45131
          -35.4225% +/- 0.428227%
          (Student's t, pooled s = 1.0815)

Sponsored by:	EMC / Isilon Storage Division
MFC after:	3 weeks
Relnotes:	yes
2015-11-06 04:45:29 +00:00
..
amd64 pmap_change_attr: Only fixup DMAP for DMAPed ranges 2015-10-29 19:07:00 +00:00
arm Make if_macb work with FDT. 2015-11-05 22:03:42 +00:00
arm64 Fix an alignment check that is wrong in half the busdma implementations. 2015-11-02 23:37:19 +00:00
boot Raspberry Pi firmware passes cache line size as a DTB parameter 2015-11-03 04:50:58 +00:00
bsm
cam Extend mask of VMware virtual disks. 2015-11-05 09:07:53 +00:00
cddl Provide information about bad DVA 2015-11-05 17:12:41 +00:00
compat Make all the LinuxKPI include files compile standalone. 2015-11-03 12:37:55 +00:00
conf Add a FAST_DEPEND option, off by default, which speeds up the build significantly. 2015-11-06 04:45:29 +00:00
contrib Fix cache issues with bulk transfers 2015-11-03 05:25:06 +00:00
crypto const'ify an arg that we don't update... 2015-07-29 23:37:15 +00:00
ddb Make kstack_pages a tunable on arm, x86, and powepc. On i386, the 2015-08-10 17:18:21 +00:00
dev otus(4) - add flags for RX filter, configuration and sniffer. 2015-11-06 03:09:26 +00:00
fs Ensure that when a blockable open of fifo returns success, a valid 2015-09-20 21:18:33 +00:00
gdb
geom Fix g_eli error loss conditions 2015-11-05 17:37:35 +00:00
gnu Fixing a memory leak on module unloading. 2015-09-11 22:43:35 +00:00
i386 The prefix for CLFLUSHOPT is 0x66. It was right on amd64. 2015-10-30 09:53:33 +00:00
isa
kern When dumping an rman in DDB, include the RID of each resource. 2015-11-05 23:12:23 +00:00
kgssapi
libkern libkern: ffs, fls: s/4/3/ the 3rd BSD clause 2015-10-22 21:04:47 +00:00
mips Remove this; it's also in sys/conf/files.mips. 2015-11-03 21:03:26 +00:00
modules Finish process of moving the LinuxKPI module into the default kernel build. 2015-10-29 08:28:39 +00:00
net Replace the fastforward path with tryforward which does not require a 2015-11-05 07:26:32 +00:00
net80211 net80211: add ieee80211_restart_all() call. 2015-10-27 20:40:57 +00:00
netgraph Bluetooth LE Security Management channel support. 2015-10-27 03:42:26 +00:00
netinet Add MTU support to carp interfaces 2015-11-05 17:23:02 +00:00
netinet6 Use m_cat() to reassembly IPv6 packets. 2015-10-27 22:11:09 +00:00
netipsec Turning on IPSEC used to introduce a slight amount of performance 2015-10-27 00:42:15 +00:00
netnatm
netpfil Remove now obsolete KASSERT. 2015-11-03 22:23:09 +00:00
netsmb
nfs Wait up to 10 seconds for late-initializing network interfaces to arrive. 2015-09-26 13:55:55 +00:00
nfsclient
nfsserver
nlm
ofed Finish process of moving the LinuxKPI module into the default kernel build. 2015-10-29 08:28:39 +00:00
opencrypto Make IPsec work with AES-GCM and AES-ICM (aka CTR) in OCF... IPsec 2015-08-04 17:47:11 +00:00
pc98 Remove compatibility shims for legacy ATA device names. 2015-10-11 13:01:51 +00:00
powerpc Use 64-bit addresses for configuring inbound and outbound address windows. 2015-11-03 00:54:14 +00:00
rpc Increase group limit for kerberized NFSv4 2015-09-26 16:30:16 +00:00
security
sparc64 Fix an alignment check that is wrong in half the busdma implementations. 2015-11-02 23:37:19 +00:00
sys Rename __sentinel to __null_sentinel 2015-11-05 14:55:58 +00:00
teken Sync HPA and VPA implementations with CUP. 2015-08-24 07:49:27 +00:00
tools Rename the /usr/share/doc/legal files to driver.LICENSE to work around 2015-10-16 00:38:05 +00:00
ufs Do not perform read-ahead for BA_CLRBUF request when we are low on 2015-10-27 13:44:13 +00:00
vm Reduce the amount of calls to VOP_BMAP() made from the local vnode 2015-10-24 21:59:22 +00:00
x86 xen/intr: fix the event channel enabled per-cpu mask 2015-11-05 14:33:46 +00:00
xdr
xen xen/intr: fix the event channel enabled per-cpu mask 2015-11-05 14:33:46 +00:00
Makefile