Project

General

Profile

Actions

Feature #14417

closed

Disable gcc's reorder-blocks-and-partition optimisation

Added by Andy Fiddaman 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

From the gcc manual at https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

-freorder-blocks-and-partition
In addition to reordering basic blocks in the compiled function, in order to reduce number of taken branches, partitions hot and cold basic blocks into separate sections of the assembly and .o files, to improve paging and cache locality performance.

This optimization is automatically turned off in the presence of exception handling, for linkonce sections, for functions with a user-defined section attribute and on any architecture that does not support named sections.

Enabled for x86 at levels -O2, -O3.

When building illumos-gate with gcc-10, this optimisation creates additional cold symbols in objects.

For example, in genunix:

$ nm /kernel/amd64/genunix | fgrep .cold
[464]   |              198772|                  18|FUNC |LOCL |0    |1      |cred2ucaud.cold
[537]   |              232595|                  20|FUNC |LOCL |0    |1      |cyclic_omni_stop.cold
[2333]  |             1044975|                  10|FUNC |LOCL |0    |1      |devmap_device.cold
[1407]  |              634691|                  10|FUNC |LOCL |0    |1      |free_action.cold
[1403]  |              632088|                  10|FUNC |LOCL |0    |1      |free_mod.cold
[1063]  |              479491|                  10|FUNC |LOCL |0    |1      |freeproc.cold
[3354]  |             1561509|                  10|FUNC |LOCL |0    |1      |getflabel_cipso.cold
[1516]  |              666274|                  10|FUNC |LOCL |0    |1      |kmem_error.cold
[2930]  |             1394313|                  10|FUNC |LOCL |0    |1      |mdi_phci_unregister.cold
[1841]  |              822193|                  10|FUNC |LOCL |0    |1      |netstack_shared_kstat_remove.cold
[1840]  |              821890|                  10|FUNC |LOCL |0    |1      |netstack_shared_zone_remove.cold
[3178]  |             1502483|                  10|FUNC |LOCL |0    |1      |pm_return_lock.cold
[3145]  |             1479103|                   2|FUNC |LOCL |0    |1      |pm_set_device_threshold.cold
[1405]  |              633595|                   9|FUNC |LOCL |0    |1      |ref_action.cold
[2795]  |             1308164|                  10|FUNC |LOCL |0    |1      |rele_dm.cold
[1406]  |              633815|                  19|FUNC |LOCL |0    |1      |unref_action.cold
[1401]  |              630780|                  10|FUNC |LOCL |0    |1      |unref_mod.cold

gcc7 does not do this, although the optimisation is similarly enabled for -O2 and above. In total there are 352 .cold symbols introduced proto objects with gcc10.


Related issues

Related to illumos gate - Feature #14421: use GCC 10 as default primary compilerIn Progress

Actions
Actions

Also available in: Atom PDF