Skip to content

Commit

Permalink
memory: enable tcmalloc for aarch64 (#13830)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@intel.com>
  • Loading branch information
rojkov authored Nov 12, 2020
1 parent 9270506 commit 5d7da33
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
26 changes: 25 additions & 1 deletion bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ config_setting(
)

# As select() can't be nested we need these specialized settings to avoid ambiguity when choosing
# tcmalloc's flavor for x86_64 builds.
# tcmalloc's flavor for x86_64 and aarch64 builds.
config_setting(
name = "disable_tcmalloc_on_linux_x86_64",
values = {
Expand All @@ -213,6 +213,30 @@ config_setting(
},
)

config_setting(
name = "disable_tcmalloc_on_linux_aarch64",
values = {
"define": "tcmalloc=disabled",
"cpu": "aarch64",
},
)

config_setting(
name = "gperftools_tcmalloc_on_linux_aarch64",
values = {
"define": "tcmalloc=gperftools",
"cpu": "aarch64",
},
)

config_setting(
name = "debug_tcmalloc_on_linux_aarch64",
values = {
"define": "tcmalloc=debug",
"cpu": "aarch64",
},
)

config_setting(
name = "disable_signal_trace",
values = {"define": "signal_trace=disabled"},
Expand Down
2 changes: 1 addition & 1 deletion bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ The following optional features can be disabled on the Bazel build command-line:
* Backtracing on signals with `--define signal_trace=disabled`
* Active stream state dump on signals with `--define signal_trace=disabled` or `--define disable_object_dump_on_signal_trace=disabled`
* tcmalloc with `--define tcmalloc=disabled`. Also you can choose Gperftools' implementation of
tcmalloc with `--define tcmalloc=gperftools` which is the default for non-x86 builds.
tcmalloc with `--define tcmalloc=gperftools` which is the default for builds other than x86_64 and aarch64.
* deprecated features with `--define deprecated_features=disabled`


Expand Down
8 changes: 8 additions & 0 deletions bazel/envoy_internal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ def envoy_copts(repository, test = False):
}) + select({
repository + "//bazel:disable_tcmalloc": ["-DABSL_MALLOC_HOOK_MMAP_DISABLE"],
repository + "//bazel:disable_tcmalloc_on_linux_x86_64": ["-DABSL_MALLOC_HOOK_MMAP_DISABLE"],
repository + "//bazel:disable_tcmalloc_on_linux_aarch64": ["-DABSL_MALLOC_HOOK_MMAP_DISABLE"],
repository + "//bazel:gperftools_tcmalloc": ["-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:gperftools_tcmalloc_on_linux_x86_64": ["-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:gperftools_tcmalloc_on_linux_aarch64": ["-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:debug_tcmalloc": ["-DENVOY_MEMORY_DEBUG_ENABLED=1", "-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:debug_tcmalloc_on_linux_x86_64": ["-DENVOY_MEMORY_DEBUG_ENABLED=1", "-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:debug_tcmalloc_on_linux_aarch64": ["-DENVOY_MEMORY_DEBUG_ENABLED=1", "-DGPERFTOOLS_TCMALLOC"],
repository + "//bazel:linux_x86_64": ["-DTCMALLOC"],
repository + "//bazel:linux_aarch64": ["-DTCMALLOC"],
"//conditions:default": ["-DGPERFTOOLS_TCMALLOC"],
}) + select({
repository + "//bazel:disable_signal_trace": [],
Expand Down Expand Up @@ -131,11 +135,15 @@ def tcmalloc_external_dep(repository):
return select({
repository + "//bazel:disable_tcmalloc": None,
repository + "//bazel:disable_tcmalloc_on_linux_x86_64": None,
repository + "//bazel:disable_tcmalloc_on_linux_aarch64": None,
repository + "//bazel:debug_tcmalloc": envoy_external_dep_path("gperftools"),
repository + "//bazel:debug_tcmalloc_on_linux_x86_64": envoy_external_dep_path("gperftools"),
repository + "//bazel:debug_tcmalloc_on_linux_aarch64": envoy_external_dep_path("gperftools"),
repository + "//bazel:gperftools_tcmalloc": envoy_external_dep_path("gperftools"),
repository + "//bazel:gperftools_tcmalloc_on_linux_x86_64": envoy_external_dep_path("gperftools"),
repository + "//bazel:gperftools_tcmalloc_on_linux_aarch64": envoy_external_dep_path("gperftools"),
repository + "//bazel:linux_x86_64": envoy_external_dep_path("tcmalloc"),
repository + "//bazel:linux_aarch64": envoy_external_dep_path("tcmalloc"),
"//conditions:default": envoy_external_dep_path("gperftools"),
})

Expand Down
4 changes: 4 additions & 0 deletions bazel/envoy_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ def tcmalloc_external_deps(repository):
return select({
repository + "//bazel:disable_tcmalloc": [],
repository + "//bazel:disable_tcmalloc_on_linux_x86_64": [],
repository + "//bazel:disable_tcmalloc_on_linux_aarch64": [],
repository + "//bazel:debug_tcmalloc": [envoy_external_dep_path("gperftools")],
repository + "//bazel:debug_tcmalloc_on_linux_x86_64": [envoy_external_dep_path("gperftools")],
repository + "//bazel:debug_tcmalloc_on_linux_aarch64": [envoy_external_dep_path("gperftools")],
repository + "//bazel:gperftools_tcmalloc": [envoy_external_dep_path("gperftools")],
repository + "//bazel:gperftools_tcmalloc_on_linux_x86_64": [envoy_external_dep_path("gperftools")],
repository + "//bazel:gperftools_tcmalloc_on_linux_aarch64": [envoy_external_dep_path("gperftools")],
repository + "//bazel:linux_x86_64": [envoy_external_dep_path("tcmalloc")],
repository + "//bazel:linux_aarch64": [envoy_external_dep_path("tcmalloc")],
"//conditions:default": [envoy_external_dep_path("gperftools")],
})

Expand Down
12 changes: 6 additions & 6 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Abseil",
project_desc = "Open source collection of C++ libraries drawn from the most fundamental pieces of Google’s internal codebase",
project_url = "https://abseil.io/",
version = "093cc27604df1c4a179b73bc3f00d4d1ce2ce113",
sha256 = "55d33c75aff05a8c4a55bdf0eddad66c71a963107bc2add96cf8eb88ddb47a80",
version = "8f1c34a77a2ba04512b7f9cbc6013d405e6a0b31",
sha256 = "635367c5cac4bbab95d0485ba9e68fa422546b06ce050190c99be7e23aba3ce3",
strip_prefix = "abseil-cpp-{version}",
urls = ["https://github.com/abseil/abseil-cpp/archive/{version}.tar.gz"],
use_category = ["dataplane_core", "controlplane"],
release_date = "2020-10-01",
release_date = "2020-10-17",
cpe = "N/A",
),
com_github_c_ares_c_ares = dict(
Expand Down Expand Up @@ -199,12 +199,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "tcmalloc",
project_desc = "Fast, multi-threaded malloc implementation",
project_url = "https://github.com/google/tcmalloc",
version = "d1311bf409db47c3441d3de6ea07d768c6551dec",
sha256 = "e22444b6544edd81f11c987dd5e482a2e00bbff717badb388779ca57525dad50",
version = "9f385356c34d4fc11f76a000b609e2b446c20667",
sha256 = "652e48e0b9ef645db04bff8a3d4841c60ce07275f5d98e18e698dc92bd111291",
strip_prefix = "tcmalloc-{version}",
urls = ["https://github.com/google/tcmalloc/archive/{version}.tar.gz"],
use_category = ["dataplane_core", "controlplane"],
release_date = "2020-09-16",
release_date = "2020-11-04",
cpe = "N/A",
),
com_github_gperftools_gperftools = dict(
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Minor Behavior Changes
* ext_authz filter: disable `envoy.reloadable_features.ext_authz_measure_timeout_on_check_created` by default.
* ext_authz filter: the deprecated field :ref:`use_alpha <envoy_api_field_config.filter.http.ext_authz.v2.ExtAuthz.use_alpha>` is no longer supported and cannot be set anymore.
* grpc_web filter: if a `grpc-accept-encoding` header is present it's passed as-is to the upstream and if it isn't `grpc-accept-encoding:identity` is sent instead. The header was always overwriten with `grpc-accept-encoding:identity,deflate,gzip` before.
* memory: enable new tcmalloc with restartable sequences for aarch64 builds.
* tls: removed RSA key transport and SHA-1 cipher suites from the client-side defaults.
* watchdog: the watchdog action :ref:`abort_action <envoy_v3_api_msg_watchdog.v3alpha.AbortActionConfig>` is now the default action to terminate the process if watchdog kill / multikill is enabled.
* xds: to support TTLs, heartbeating has been added to xDS. As a result, responses that contain empty resources without updating the version will no longer be propagated to the
Expand Down

0 comments on commit 5d7da33

Please sign in to comment.