Move arena into resource quota (#28008)

* new resource quota integration

* Automated change: Fix sanity tests

* fix

* fix

* fixes

* fixes

* fixes

* Automated change: Fix sanity tests

* fixes

* fixes

* Automated change: Fix sanity tests

* fixes

* fix

* fixes

* windows-fix

* fixes

* fixes

* fix

* fix-asan

* banned

* banned

* fixes

* clang-tidy-fix

* Automated change: Fix sanity tests

* fix-cronet

* review feedback

* review feedback

* Automated change: Fix sanity tests

* fixes

* bug fix

* fixes

* compile fix

* exclude megabyte size payloads from 1byte tests

* windows fix

* start moving ios

* keep moving windows

* Get windows compilation working.

* Automated change: Fix sanity tests

* better

* fixes

* remove slice buffer from memory_allocator.h

* Revert "remove slice buffer from memory_allocator.h"

This reverts commit 234a63b6e3.

* ugh

* #fixtests

* pthread tls fixes

* Automated change: Fix sanity tests

* fixfixfix

* xxx

* add reset

* review feedback

* fix

* fix

* fixes

* fix

* mac progress

* cpp-impl-of

* rename ptr

* Automated change: Fix sanity tests

* memory-owner-is-a-memory-allocator

* fixes

* fix

* fix from prod

* fix

* Fix issue leading to bad pointers being returned on Windows.

* Automated change: Fix sanity tests

* fix multislice bug

* argh

* hyrums law fixes

* hyrums law fixes

* clang-format

* hyrums law fixes

* Move arena into resource quota

* Remove redundant constant

* fixup the tests

* Automated change: Fix sanity tests

* fiiixes

* Automated change: Fix sanity tests

* fixes

* Automated change: Fix sanity tests

* fixes

* fix

* fix

* Automated change: Fix sanity tests

* fixes

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/28287/head
Craig Tiller 3 years ago committed by GitHub
parent 81a4ea444e
commit ad424a2ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      BUILD
  2. 166
      CMakeLists.txt
  3. 3
      Makefile
  4. 314
      build_autogenerated.yaml
  5. 2
      config.m4
  6. 2
      config.w32
  7. 4
      gRPC-C++.podspec
  8. 6
      gRPC-Core.podspec
  9. 4
      grpc.gemspec
  10. 3
      grpc.gyp
  11. 4
      package.xml
  12. 2
      src/core/ext/filters/client_channel/backend_metric.h
  13. 2
      src/core/ext/filters/client_channel/config_selector.h
  14. 2
      src/core/ext/filters/client_channel/dynamic_filters.h
  15. 8
      src/core/ext/filters/client_channel/health/health_check_client.cc
  16. 5
      src/core/ext/filters/client_channel/health/health_check_client.h
  17. 2
      src/core/ext/filters/client_channel/subchannel.h
  18. 5
      src/core/ext/transport/binder/client/channel_create_impl.cc
  19. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  20. 2
      src/core/ext/transport/chttp2/transport/internal.h
  21. 2
      src/core/lib/channel/channel_stack.h
  22. 4
      src/core/lib/channel/channel_stack_builder.cc
  23. 2
      src/core/lib/channel/channel_stack_builder.h
  24. 2
      src/core/lib/gprpp/chunked_vector.h
  25. 2
      src/core/lib/promise/arena_promise.h
  26. 1
      src/core/lib/resource_quota/api.h
  27. 29
      src/core/lib/resource_quota/arena.cc
  28. 32
      src/core/lib/resource_quota/arena.h
  29. 2
      src/core/lib/security/context/security_context.cc
  30. 2
      src/core/lib/security/context/security_context.h
  31. 5
      src/core/lib/surface/call.cc
  32. 2
      src/core/lib/surface/call.h
  33. 20
      src/core/lib/surface/channel.cc
  34. 3
      src/core/lib/surface/channel.h
  35. 2
      src/core/lib/transport/transport.h
  36. 2
      src/python/grpcio/grpc_core_dependencies.py
  37. 6
      test/core/end2end/fixtures/h2_sockpair.cc
  38. 6
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  39. 3
      test/core/end2end/fuzzers/api_fuzzer.cc
  40. 9
      test/core/end2end/fuzzers/client_fuzzer.cc
  41. 4
      test/core/end2end/fuzzers/server_fuzzer.cc
  42. 13
      test/core/gpr/arena_test.cc
  43. 2
      test/core/gprpp/BUILD
  44. 7
      test/core/gprpp/chunked_vector_fuzzer.cc
  45. 15
      test/core/gprpp/chunked_vector_test.cc
  46. 1
      test/core/promise/BUILD
  47. 9
      test/core/promise/arena_promise_test.cc
  48. 20
      test/core/transport/binder/binder_transport_test.cc
  49. 10
      test/core/transport/binder/end2end/testing_channel_create.cc
  50. 5
      test/core/transport/binder/end2end/testing_channel_create.h
  51. 11
      test/core/transport/chttp2/hpack_encoder_test.cc
  52. 6
      test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
  53. 7
      test/core/transport/chttp2/hpack_parser_test.cc
  54. 14
      test/core/transport/metadata_map_test.cc
  55. 13
      test/core/transport/metadata_test.cc
  56. 5
      test/core/util/evaluate_args_test_util.h
  57. 15
      test/cpp/microbenchmarks/bm_arena.cc
  58. 19
      test/cpp/microbenchmarks/bm_call_create.cc
  59. 13
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  60. 14
      test/cpp/microbenchmarks/bm_chttp2_transport.cc
  61. 4
      tools/doxygen/Doxyfile.c++.internal
  62. 4
      tools/doxygen/Doxyfile.core.internal

21
BUILD

@ -609,6 +609,7 @@ grpc_cc_library(
"include/grpcpp/security/binder_credentials.h",
],
deps = [
"config",
"gpr",
"gpr_base",
"gpr_platform",
@ -805,7 +806,6 @@ grpc_cc_library(
"src/core/lib/gpr/tmpfile_posix.cc",
"src/core/lib/gpr/tmpfile_windows.cc",
"src/core/lib/gpr/wrap_memcpy.cc",
"src/core/lib/gprpp/arena.cc",
"src/core/lib/gprpp/examine_stack.cc",
"src/core/lib/gprpp/fork.cc",
"src/core/lib/gprpp/global_config_env.cc",
@ -829,7 +829,6 @@ grpc_cc_library(
"src/core/lib/gpr/string_windows.h",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tmpfile.h",
"src/core/lib/gprpp/arena.h",
"src/core/lib/gprpp/examine_stack.h",
"src/core/lib/gprpp/fork.h",
"src/core/lib/gprpp/global_config.h",
@ -887,6 +886,7 @@ grpc_cc_library(
hdrs = ["src/core/lib/gprpp/chunked_vector.h"],
external_deps = ["absl/utility"],
deps = [
"arena",
# TODO(ctiller): weaken this to just arena when that splits into its own target
"gpr_base",
],
@ -1099,6 +1099,7 @@ grpc_cc_library(
"src/core/lib/promise/arena_promise.h",
],
deps = [
"arena",
"gpr_base",
"poll",
],
@ -1499,6 +1500,20 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "arena",
srcs = [
"src/core/lib/resource_quota/arena.cc",
],
hdrs = [
"src/core/lib/resource_quota/arena.h",
],
deps = [
"gpr_base",
"memory_quota",
],
)
grpc_cc_library(
name = "thread_quota",
srcs = [
@ -2041,6 +2056,7 @@ grpc_cc_library(
public_hdrs = GRPC_PUBLIC_HDRS + GRPC_PUBLIC_EVENT_ENGINE_HDRS,
visibility = ["@grpc:alt_grpc_base_legacy"],
deps = [
"arena",
"avl",
"bitset",
"channel_args",
@ -3390,6 +3406,7 @@ grpc_cc_library(
visibility = ["@grpc:public"],
deps = [
"alts_util",
"arena",
"config",
"error",
"gpr_base",

166
CMakeLists.txt generated

@ -1397,7 +1397,6 @@ add_library(gpr
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -1993,6 +1992,7 @@ add_library(grpc
src/core/lib/matchers/matchers.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/api.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
@ -2639,6 +2639,7 @@ add_library(grpc_unsecure
src/core/lib/json/json_writer.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/api.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
@ -7577,7 +7578,6 @@ add_executable(activity_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -7898,53 +7898,23 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(arena_promise_test
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/cpu_iphone.cc
src/core/lib/gpr/cpu_linux.cc
src/core/lib/gpr/cpu_posix.cc
src/core/lib/gpr/cpu_windows.cc
src/core/lib/gpr/env_linux.cc
src/core/lib/gpr/env_posix.cc
src/core/lib/gpr/env_windows.cc
src/core/lib/gpr/log.cc
src/core/lib/gpr/log_android.cc
src/core/lib/gpr/log_linux.cc
src/core/lib/gpr/log_posix.cc
src/core/lib/gpr/log_windows.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gpr/string.cc
src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
src/core/lib/gpr/time.cc
src/core/lib/gpr/time_posix.cc
src/core/lib/gpr/time_precise.cc
src/core/lib/gpr/time_windows.cc
src/core/lib/gpr/tmpfile_msys.cc
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
src/core/lib/gprpp/host_port.cc
src/core/lib/gprpp/mpscq.cc
src/core/lib/gprpp/stat_posix.cc
src/core/lib/gprpp/stat_windows.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/thd_posix.cc
src/core/lib/gprpp/thd_windows.cc
src/core/lib/gprpp/time_util.cc
src/core/lib/profiling/basic_timers.cc
src/core/lib/profiling/stap_timers.cc
src/core/lib/debug/trace.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/iomgr/combiner.cc
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/exec_ctx.cc
src/core/lib/iomgr/executor.cc
src/core/lib/iomgr/iomgr_internal.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/slice/static_slice.cc
test/core/promise/arena_promise_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -7972,19 +7942,9 @@ target_include_directories(arena_promise_test
target_link_libraries(arena_promise_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::base
absl::core_headers
absl::memory
absl::random_random
absl::status
absl::cord
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::optional
absl::statusor
absl::variant
upb
gpr
)
@ -9161,53 +9121,23 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(chunked_vector_test
src/core/ext/upb-generated/google/protobuf/any.upb.c
src/core/ext/upb-generated/google/rpc/status.upb.c
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/cpu_iphone.cc
src/core/lib/gpr/cpu_linux.cc
src/core/lib/gpr/cpu_posix.cc
src/core/lib/gpr/cpu_windows.cc
src/core/lib/gpr/env_linux.cc
src/core/lib/gpr/env_posix.cc
src/core/lib/gpr/env_windows.cc
src/core/lib/gpr/log.cc
src/core/lib/gpr/log_android.cc
src/core/lib/gpr/log_linux.cc
src/core/lib/gpr/log_posix.cc
src/core/lib/gpr/log_windows.cc
src/core/lib/gpr/murmur_hash.cc
src/core/lib/gpr/string.cc
src/core/lib/gpr/string_posix.cc
src/core/lib/gpr/string_util_windows.cc
src/core/lib/gpr/string_windows.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/sync_posix.cc
src/core/lib/gpr/sync_windows.cc
src/core/lib/gpr/time.cc
src/core/lib/gpr/time_posix.cc
src/core/lib/gpr/time_precise.cc
src/core/lib/gpr/time_windows.cc
src/core/lib/gpr/tmpfile_msys.cc
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
src/core/lib/gprpp/host_port.cc
src/core/lib/gprpp/mpscq.cc
src/core/lib/gprpp/stat_posix.cc
src/core/lib/gprpp/stat_windows.cc
src/core/lib/gprpp/status_helper.cc
src/core/lib/gprpp/thd_posix.cc
src/core/lib/gprpp/thd_windows.cc
src/core/lib/gprpp/time_util.cc
src/core/lib/profiling/basic_timers.cc
src/core/lib/profiling/stap_timers.cc
src/core/lib/debug/trace.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/iomgr/combiner.cc
src/core/lib/iomgr/error.cc
src/core/lib/iomgr/exec_ctx.cc
src/core/lib/iomgr/executor.cc
src/core/lib/iomgr/iomgr_internal.cc
src/core/lib/promise/activity.cc
src/core/lib/resource_quota/arena.cc
src/core/lib/resource_quota/memory_quota.cc
src/core/lib/resource_quota/resource_quota.cc
src/core/lib/resource_quota/thread_quota.cc
src/core/lib/resource_quota/trace.cc
src/core/lib/slice/slice.cc
src/core/lib/slice/slice_refcount.cc
src/core/lib/slice/slice_string_helpers.cc
src/core/lib/slice/static_slice.cc
test/core/gprpp/chunked_vector_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -9235,19 +9165,10 @@ target_include_directories(chunked_vector_test
target_link_libraries(chunked_vector_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
absl::base
absl::core_headers
absl::memory
absl::random_random
absl::status
absl::cord
absl::str_format
absl::strings
absl::synchronization
absl::time
absl::optional
absl::statusor
absl::variant
absl::utility
upb
gpr
)
@ -9861,7 +9782,6 @@ add_executable(core_configuration_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -10918,7 +10838,6 @@ add_executable(for_each_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -12662,7 +12581,6 @@ add_executable(latch_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -13325,7 +13243,6 @@ add_executable(observable_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc
@ -13598,7 +13515,6 @@ add_executable(pipe_test
src/core/lib/gpr/tmpfile_posix.cc
src/core/lib/gpr/tmpfile_windows.cc
src/core/lib/gpr/wrap_memcpy.cc
src/core/lib/gprpp/arena.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
src/core/lib/gprpp/global_config_env.cc

3
Makefile generated

@ -925,7 +925,6 @@ LIBGPR_SRC = \
src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/global_config_env.cc \
@ -1491,6 +1490,7 @@ LIBGRPC_SRC = \
src/core/lib/matchers/matchers.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \
@ -1985,6 +1985,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/json/json_writer.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \

@ -312,7 +312,6 @@ libs:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
@ -365,7 +364,6 @@ libs:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -868,6 +866,7 @@ libs:
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/api.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
@ -1456,6 +1455,7 @@ libs:
- src/core/lib/matchers/matchers.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/api.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
@ -1970,6 +1970,7 @@ libs:
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/api.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
@ -2255,6 +2256,7 @@ libs:
- src/core/lib/json/json_writer.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/api.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
@ -4353,7 +4355,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -4422,7 +4423,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -4556,102 +4556,69 @@ targets:
build: test
language: c++
headers:
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/gpr/alloc.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gpr/string.h
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
- src/core/lib/gprpp/fork.h
- src/core/lib/gprpp/global_config.h
- src/core/lib/gprpp/global_config_custom.h
- src/core/lib/gprpp/global_config_env.h
- src/core/lib/gprpp/global_config_generic.h
- src/core/lib/gprpp/host_port.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/stat.h
- src/core/lib/gprpp/status_helper.h
- src/core/lib/gprpp/sync.h
- src/core/lib/gprpp/thd.h
- src/core/lib/gprpp/time_util.h
- src/core/lib/profiling/timers.h
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/cpp_impl_of.h
- src/core/lib/gprpp/dual_ref_counted.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
- src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/combiner.h
- src/core/lib/iomgr/error.h
- src/core/lib/iomgr/error_internal.h
- src/core/lib/iomgr/exec_ctx.h
- src/core/lib/iomgr/executor.h
- src/core/lib/iomgr/iomgr_internal.h
- src/core/lib/promise/activity.h
- src/core/lib/promise/arena_promise.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/promise_factory.h
- src/core/lib/promise/detail/promise_like.h
- src/core/lib/promise/detail/status.h
- src/core/lib/promise/detail/switch.h
- src/core/lib/promise/exec_ctx_wakeup_scheduler.h
- src/core/lib/promise/loop.h
- src/core/lib/promise/map.h
- src/core/lib/promise/poll.h
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
- src/core/lib/resource_quota/trace.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/slice/slice_utils.h
- src/core/lib/slice/static_slice.h
src:
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/cpu_iphone.cc
- src/core/lib/gpr/cpu_linux.cc
- src/core/lib/gpr/cpu_posix.cc
- src/core/lib/gpr/cpu_windows.cc
- src/core/lib/gpr/env_linux.cc
- src/core/lib/gpr/env_posix.cc
- src/core/lib/gpr/env_windows.cc
- src/core/lib/gpr/log.cc
- src/core/lib/gpr/log_android.cc
- src/core/lib/gpr/log_linux.cc
- src/core/lib/gpr/log_posix.cc
- src/core/lib/gpr/log_windows.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gpr/string.cc
- src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
- src/core/lib/gpr/time.cc
- src/core/lib/gpr/time_posix.cc
- src/core/lib/gpr/time_precise.cc
- src/core/lib/gpr/time_windows.cc
- src/core/lib/gpr/tmpfile_msys.cc
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
- src/core/lib/gprpp/host_port.cc
- src/core/lib/gprpp/mpscq.cc
- src/core/lib/gprpp/stat_posix.cc
- src/core/lib/gprpp/stat_windows.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/thd_posix.cc
- src/core/lib/gprpp/thd_windows.cc
- src/core/lib/gprpp/time_util.cc
- src/core/lib/profiling/basic_timers.cc
- src/core/lib/profiling/stap_timers.cc
- src/core/lib/debug/trace.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/iomgr/combiner.cc
- src/core/lib/iomgr/error.cc
- src/core/lib/iomgr/exec_ctx.cc
- src/core/lib/iomgr/executor.cc
- src/core/lib/iomgr/iomgr_internal.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/slice/static_slice.cc
- test/core/promise/arena_promise_test.cc
deps:
- absl/base:base
- absl/base:core_headers
- absl/memory:memory
- absl/random:random
- absl/status:status
- absl/strings:cord
- absl/strings:str_format
- absl/strings:strings
- absl/synchronization:synchronization
- absl/time:time
- absl/types:optional
- absl/status:statusor
- absl/types:variant
- upb
- gpr
uses_polling: false
- name: async_end2end_test
gtest: true
@ -5102,101 +5069,70 @@ targets:
build: test
language: c++
headers:
- src/core/ext/upb-generated/google/protobuf/any.upb.h
- src/core/ext/upb-generated/google/rpc/status.upb.h
- src/core/lib/gpr/alloc.h
- src/core/lib/gpr/env.h
- src/core/lib/gpr/murmur_hash.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gpr/string.h
- src/core/lib/gpr/string_windows.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/debug/trace.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/chunked_vector.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
- src/core/lib/gprpp/fork.h
- src/core/lib/gprpp/global_config.h
- src/core/lib/gprpp/global_config_custom.h
- src/core/lib/gprpp/global_config_env.h
- src/core/lib/gprpp/global_config_generic.h
- src/core/lib/gprpp/host_port.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/memory.h
- src/core/lib/gprpp/mpscq.h
- src/core/lib/gprpp/stat.h
- src/core/lib/gprpp/status_helper.h
- src/core/lib/gprpp/sync.h
- src/core/lib/gprpp/thd.h
- src/core/lib/gprpp/time_util.h
- src/core/lib/profiling/timers.h
- src/core/lib/gprpp/cpp_impl_of.h
- src/core/lib/gprpp/dual_ref_counted.h
- src/core/lib/gprpp/orphanable.h
- src/core/lib/gprpp/ref_counted.h
- src/core/lib/gprpp/ref_counted_ptr.h
- src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/combiner.h
- src/core/lib/iomgr/error.h
- src/core/lib/iomgr/error_internal.h
- src/core/lib/iomgr/exec_ctx.h
- src/core/lib/iomgr/executor.h
- src/core/lib/iomgr/iomgr_internal.h
- src/core/lib/promise/activity.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/promise_factory.h
- src/core/lib/promise/detail/promise_like.h
- src/core/lib/promise/detail/status.h
- src/core/lib/promise/detail/switch.h
- src/core/lib/promise/exec_ctx_wakeup_scheduler.h
- src/core/lib/promise/loop.h
- src/core/lib/promise/map.h
- src/core/lib/promise/poll.h
- src/core/lib/promise/race.h
- src/core/lib/promise/seq.h
- src/core/lib/resource_quota/arena.h
- src/core/lib/resource_quota/memory_quota.h
- src/core/lib/resource_quota/resource_quota.h
- src/core/lib/resource_quota/thread_quota.h
- src/core/lib/resource_quota/trace.h
- src/core/lib/slice/slice.h
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_refcount_base.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/slice/slice_utils.h
- src/core/lib/slice/static_slice.h
src:
- src/core/ext/upb-generated/google/protobuf/any.upb.c
- src/core/ext/upb-generated/google/rpc/status.upb.c
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/cpu_iphone.cc
- src/core/lib/gpr/cpu_linux.cc
- src/core/lib/gpr/cpu_posix.cc
- src/core/lib/gpr/cpu_windows.cc
- src/core/lib/gpr/env_linux.cc
- src/core/lib/gpr/env_posix.cc
- src/core/lib/gpr/env_windows.cc
- src/core/lib/gpr/log.cc
- src/core/lib/gpr/log_android.cc
- src/core/lib/gpr/log_linux.cc
- src/core/lib/gpr/log_posix.cc
- src/core/lib/gpr/log_windows.cc
- src/core/lib/gpr/murmur_hash.cc
- src/core/lib/gpr/string.cc
- src/core/lib/gpr/string_posix.cc
- src/core/lib/gpr/string_util_windows.cc
- src/core/lib/gpr/string_windows.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/sync_posix.cc
- src/core/lib/gpr/sync_windows.cc
- src/core/lib/gpr/time.cc
- src/core/lib/gpr/time_posix.cc
- src/core/lib/gpr/time_precise.cc
- src/core/lib/gpr/time_windows.cc
- src/core/lib/gpr/tmpfile_msys.cc
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
- src/core/lib/gprpp/host_port.cc
- src/core/lib/gprpp/mpscq.cc
- src/core/lib/gprpp/stat_posix.cc
- src/core/lib/gprpp/stat_windows.cc
- src/core/lib/gprpp/status_helper.cc
- src/core/lib/gprpp/thd_posix.cc
- src/core/lib/gprpp/thd_windows.cc
- src/core/lib/gprpp/time_util.cc
- src/core/lib/profiling/basic_timers.cc
- src/core/lib/profiling/stap_timers.cc
- src/core/lib/debug/trace.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/iomgr/combiner.cc
- src/core/lib/iomgr/error.cc
- src/core/lib/iomgr/exec_ctx.cc
- src/core/lib/iomgr/executor.cc
- src/core/lib/iomgr/iomgr_internal.cc
- src/core/lib/promise/activity.cc
- src/core/lib/resource_quota/arena.cc
- src/core/lib/resource_quota/memory_quota.cc
- src/core/lib/resource_quota/resource_quota.cc
- src/core/lib/resource_quota/thread_quota.cc
- src/core/lib/resource_quota/trace.cc
- src/core/lib/slice/slice.cc
- src/core/lib/slice/slice_refcount.cc
- src/core/lib/slice/slice_string_helpers.cc
- src/core/lib/slice/static_slice.cc
- test/core/gprpp/chunked_vector_test.cc
deps:
- absl/base:base
- absl/base:core_headers
- absl/memory:memory
- absl/random:random
- absl/status:status
- absl/strings:cord
- absl/strings:str_format
- absl/strings:strings
- absl/synchronization:synchronization
- absl/time:time
- absl/types:optional
- absl/status:statusor
- absl/types:variant
- absl/utility:utility
- upb
- gpr
uses_polling: false
- name: cli_call_test
gtest: true
@ -5411,7 +5347,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
- src/core/lib/gprpp/examine_stack.h
@ -5470,7 +5405,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -5972,7 +5906,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -6045,7 +5978,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -6616,7 +6548,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -6685,7 +6616,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -6953,7 +6883,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/debug_location.h
@ -7020,7 +6949,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc
@ -7120,7 +7048,6 @@ targets:
- src/core/lib/gpr/tls.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/arena.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/construct_destruct.h
@ -7190,7 +7117,6 @@ targets:
- src/core/lib/gpr/tmpfile_posix.cc
- src/core/lib/gpr/tmpfile_windows.cc
- src/core/lib/gpr/wrap_memcpy.cc
- src/core/lib/gprpp/arena.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
- src/core/lib/gprpp/global_config_env.cc

2
config.m4 generated

@ -435,7 +435,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
src/core/lib/gprpp/global_config_env.cc \
@ -553,6 +552,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/profiling/stap_timers.cc \
src/core/lib/promise/activity.cc \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/resource_quota.cc \
src/core/lib/resource_quota/thread_quota.cc \

2
config.w32 generated

@ -401,7 +401,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\gpr\\tmpfile_posix.cc " +
"src\\core\\lib\\gpr\\tmpfile_windows.cc " +
"src\\core\\lib\\gpr\\wrap_memcpy.cc " +
"src\\core\\lib\\gprpp\\arena.cc " +
"src\\core\\lib\\gprpp\\examine_stack.cc " +
"src\\core\\lib\\gprpp\\fork.cc " +
"src\\core\\lib\\gprpp\\global_config_env.cc " +
@ -519,6 +518,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\profiling\\stap_timers.cc " +
"src\\core\\lib\\promise\\activity.cc " +
"src\\core\\lib\\resource_quota\\api.cc " +
"src\\core\\lib\\resource_quota\\arena.cc " +
"src\\core\\lib\\resource_quota\\memory_quota.cc " +
"src\\core\\lib\\resource_quota\\resource_quota.cc " +
"src\\core\\lib\\resource_quota\\thread_quota.cc " +

4
gRPC-C++.podspec generated

@ -609,7 +609,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -732,6 +731,7 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',
@ -1332,7 +1332,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1455,6 +1454,7 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',

6
gRPC-Core.podspec generated

@ -943,8 +943,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/useful.h',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1184,6 +1182,8 @@ Pod::Spec.new do |s|
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.cc',
@ -1868,7 +1868,6 @@ Pod::Spec.new do |s|
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1991,6 +1990,7 @@ Pod::Spec.new do |s|
'src/core/lib/promise/race.h',
'src/core/lib/promise/seq.h',
'src/core/lib/resource_quota/api.h',
'src/core/lib/resource_quota/arena.h',
'src/core/lib/resource_quota/memory_quota.h',
'src/core/lib/resource_quota/resource_quota.h',
'src/core/lib/resource_quota/thread_quota.h',

4
grpc.gemspec generated

@ -862,8 +862,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/gpr/tmpfile_windows.cc )
s.files += %w( src/core/lib/gpr/useful.h )
s.files += %w( src/core/lib/gpr/wrap_memcpy.cc )
s.files += %w( src/core/lib/gprpp/arena.cc )
s.files += %w( src/core/lib/gprpp/arena.h )
s.files += %w( src/core/lib/gprpp/atomic_utils.h )
s.files += %w( src/core/lib/gprpp/bitset.h )
s.files += %w( src/core/lib/gprpp/chunked_vector.h )
@ -1103,6 +1101,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/promise/seq.h )
s.files += %w( src/core/lib/resource_quota/api.cc )
s.files += %w( src/core/lib/resource_quota/api.h )
s.files += %w( src/core/lib/resource_quota/arena.cc )
s.files += %w( src/core/lib/resource_quota/arena.h )
s.files += %w( src/core/lib/resource_quota/memory_quota.cc )
s.files += %w( src/core/lib/resource_quota/memory_quota.h )
s.files += %w( src/core/lib/resource_quota/resource_quota.cc )

3
grpc.gyp generated

@ -447,7 +447,6 @@
'src/core/lib/gpr/tmpfile_posix.cc',
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/examine_stack.cc',
'src/core/lib/gprpp/fork.cc',
'src/core/lib/gprpp/global_config_env.cc',
@ -946,6 +945,7 @@
'src/core/lib/matchers/matchers.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',
@ -1412,6 +1412,7 @@
'src/core/lib/json/json_writer.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',

4
package.xml generated

@ -842,8 +842,6 @@
<file baseinstalldir="/" name="src/core/lib/gpr/tmpfile_windows.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/wrap_memcpy.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/arena.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/bitset.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/chunked_vector.h" role="src" />
@ -1083,6 +1081,8 @@
<file baseinstalldir="/" name="src/core/lib/promise/seq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/api.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/api.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/arena.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/arena.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/memory_quota.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/memory_quota.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/resource_quota/resource_quota.cc" role="src" />

@ -22,7 +22,7 @@
#include <grpc/slice.h>
#include "src/core/ext/filters/client_channel/lb_policy.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
namespace grpc_core {

@ -31,9 +31,9 @@
#include "src/core/ext/service_config/service_config_call_data.h"
#include "src/core/ext/service_config/service_config_parser.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/metadata_batch.h"
// Channel arg key for ConfigSelector.

@ -23,10 +23,10 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -29,6 +29,7 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/proto/grpc/health/v1/health.upb.h"
@ -60,6 +61,10 @@ HealthCheckClient::HealthCheckClient(
connected_subchannel_(std::move(connected_subchannel)),
interested_parties_(interested_parties),
channelz_node_(std::move(channelz_node)),
call_allocator_(
ResourceQuotaFromChannelArgs(connected_subchannel_->args())
->memory_quota()
->CreateMemoryAllocator(service_name_)),
watcher_(std::move(watcher)),
retry_backoff_(
BackOff::Options()
@ -254,7 +259,8 @@ HealthCheckClient::CallState::CallState(
: health_check_client_(std::move(health_check_client)),
pollent_(grpc_polling_entity_create_from_pollset_set(interested_parties)),
arena_(Arena::Create(health_check_client_->connected_subchannel_
->GetInitialCallSizeEstimate())),
->GetInitialCallSizeEstimate(),
&health_check_client_->call_allocator_)),
payload_(context_),
send_initial_metadata_(arena_),
send_trailing_metadata_(arena_),

@ -29,7 +29,6 @@
#include "src/core/ext/filters/client_channel/client_channel_channelz.h"
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -37,6 +36,7 @@
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
@ -60,7 +60,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
class CallState : public Orphanable {
public:
CallState(RefCountedPtr<HealthCheckClient> health_check_client,
grpc_pollset_set* interested_parties_);
grpc_pollset_set* interested_parties);
~CallState() override;
void Orphan() override;
@ -155,6 +155,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
RefCountedPtr<ConnectedSubchannel> connected_subchannel_;
grpc_pollset_set* interested_parties_; // Do not own.
RefCountedPtr<channelz::SubchannelNode> channelz_node_;
MemoryAllocator call_allocator_;
Mutex mu_;
RefCountedPtr<ConnectivityStateWatcherInterface> watcher_

@ -27,13 +27,13 @@
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/metadata.h"

@ -25,6 +25,7 @@
#include "src/core/ext/transport/binder/transport/binder_transport.h"
#include "src/core/ext/transport/binder/wire_format/binder.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
@ -53,6 +54,9 @@ grpc_channel* CreateDirectBinderChannelImplForTesting(
grpc_arg default_authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("binder.authority"));
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args* final_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
grpc_error_handle error = GRPC_ERROR_NONE;
@ -61,6 +65,7 @@ grpc_channel* CreateDirectBinderChannelImplForTesting(
GRPC_CLIENT_DIRECT_CHANNEL, transport, &error);
// TODO(mingcl): Handle error properly
GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(final_args);
return channel;
}

@ -650,10 +650,6 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
: t(t),
refcount(refcount),
reffer(this),
stream_reservation(t->memory_owner.MakeReservation(
grpc_core::kResourceQuotaCallSize)), // TODO(ctiller): sizeof(*this),
// or better, move allocation to
// memory quota.
initial_metadata_buffer(arena),
trailing_metadata_buffer(arena) {
if (server_data) {

@ -523,8 +523,6 @@ struct grpc_chttp2_stream {
explicit Reffer(grpc_chttp2_stream* s);
} reffer;
grpc_core::MemoryAllocator::Reservation stream_reservation;
grpc_closure destroy_stream;
grpc_closure* destroy_stream_arg;

@ -54,9 +54,9 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/transport.h"
typedef struct grpc_channel_element grpc_channel_element;

@ -69,9 +69,9 @@ void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder* b,
b->target = gpr_strdup(target);
}
const char* grpc_channel_stack_builder_get_target(
std::string grpc_channel_stack_builder_get_target(
grpc_channel_stack_builder* b) {
return b->target;
return b->target == nullptr ? std::string() : std::string(b->target);
}
static grpc_channel_stack_builder_iterator* create_iterator_at_filter_node(

@ -43,7 +43,7 @@ void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder* builder,
void grpc_channel_stack_builder_set_target(grpc_channel_stack_builder* b,
const char* target);
const char* grpc_channel_stack_builder_get_target(
std::string grpc_channel_stack_builder_get_target(
grpc_channel_stack_builder* b);
/// Attach \a transport to the builder (does not take ownership)

@ -17,8 +17,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -19,8 +19,8 @@
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/promise/poll.h"
#include "src/core/lib/resource_quota/arena.h"
namespace grpc_core {

@ -27,7 +27,6 @@ namespace grpc_core {
// TODO(ctiller): This is a hack. We need to do real accounting instead of
// hard coding.
constexpr size_t kResourceQuotaCallSize = 15 * 1024;
constexpr size_t kResourceQuotaChannelSize = 50 * 1024;
// Retrieve the resource quota from the channel args.

@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/resource_quota/arena.h"
#include <string.h>
@ -61,22 +61,24 @@ Arena::~Arena() {
}
}
Arena* Arena::Create(size_t initial_size) {
return new (ArenaStorage(initial_size)) Arena(initial_size);
Arena* Arena::Create(size_t initial_size, MemoryAllocator* memory_allocator) {
return new (ArenaStorage(initial_size))
Arena(initial_size, 0, memory_allocator);
}
std::pair<Arena*, void*> Arena::CreateWithAlloc(size_t initial_size,
size_t alloc_size) {
std::pair<Arena*, void*> Arena::CreateWithAlloc(
size_t initial_size, size_t alloc_size, MemoryAllocator* memory_allocator) {
static constexpr size_t base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Arena));
auto* new_arena =
new (ArenaStorage(initial_size)) Arena(initial_size, alloc_size);
auto* new_arena = new (ArenaStorage(initial_size))
Arena(initial_size, alloc_size, memory_allocator);
void* first_alloc = reinterpret_cast<char*>(new_arena) + base_size;
return std::make_pair(new_arena, first_alloc);
}
size_t Arena::Destroy() {
size_t size = total_used_.load(std::memory_order_relaxed);
memory_allocator_->Release(total_allocated_.load(std::memory_order_relaxed));
this->~Arena();
gpr_free_aligned(this);
return size;
@ -91,13 +93,14 @@ void* Arena::AllocZone(size_t size) {
static constexpr size_t zone_base_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(Zone));
size_t alloc_size = zone_base_size + size;
memory_allocator_->Reserve(alloc_size);
total_allocated_.fetch_add(alloc_size, std::memory_order_relaxed);
Zone* z = new (gpr_malloc_aligned(alloc_size, GPR_MAX_ALIGNMENT)) Zone();
{
gpr_spinlock_lock(&arena_growth_spinlock_);
z->prev = last_zone_;
last_zone_ = z;
gpr_spinlock_unlock(&arena_growth_spinlock_);
}
auto* prev = last_zone_.load(std::memory_order_relaxed);
do {
z->prev = prev;
} while (!last_zone_.compare_exchange_weak(prev, z, std::memory_order_relaxed,
std::memory_order_relaxed));
return reinterpret_cast<char*>(z) + zone_base_size;
}

@ -22,8 +22,8 @@
// Tracks the total memory allocated against it, so that future arenas can
// pre-allocate the right amount of memory
#ifndef GRPC_CORE_LIB_GPRPP_ARENA_H
#define GRPC_CORE_LIB_GPRPP_ARENA_H
#ifndef GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H
#define GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H
#include <grpc/support/port_platform.h>
@ -38,20 +38,21 @@
#include <grpc/support/sync.h>
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gpr/spinlock.h"
#include "src/core/lib/resource_quota/memory_quota.h"
namespace grpc_core {
class Arena {
public:
// Create an arena, with \a initial_size bytes in the first allocated buffer.
static Arena* Create(size_t initial_size);
static Arena* Create(size_t initial_size, MemoryAllocator* memory_allocator);
// Create an arena, with \a initial_size bytes in the first allocated buffer,
// and return both a void pointer to the returned arena and a void* with the
// first allocation.
static std::pair<Arena*, void*> CreateWithAlloc(size_t initial_size,
size_t alloc_size);
static std::pair<Arena*, void*> CreateWithAlloc(
size_t initial_size, size_t alloc_size,
MemoryAllocator* memory_allocator);
// Destroy an arena, returning the total number of bytes allocated.
size_t Destroy();
@ -96,9 +97,11 @@ class Arena {
// quick optimization (avoiding an atomic fetch-add) for the common case
// where we wish to create an arena and then perform an immediate
// allocation.
explicit Arena(size_t initial_size, size_t initial_alloc = 0)
explicit Arena(size_t initial_size, size_t initial_alloc,
MemoryAllocator* memory_allocator)
: total_used_(GPR_ROUND_UP_TO_ALIGNMENT_SIZE(initial_alloc)),
initial_zone_size_(initial_size) {}
initial_zone_size_(initial_size),
memory_allocator_(memory_allocator) {}
~Arena();
@ -107,14 +110,16 @@ class Arena {
// Keep track of the total used size. We use this in our call sizing
// hysteresis.
std::atomic<size_t> total_used_{0};
std::atomic<size_t> total_allocated_{0};
const size_t initial_zone_size_;
gpr_spinlock arena_growth_spinlock_ = GPR_SPINLOCK_STATIC_INITIALIZER;
// If the initial arena allocation wasn't enough, we allocate additional zones
// in a reverse linked list. Each additional zone consists of (1) a pointer to
// the zone added before this zone (null if this is the first additional zone)
// and (2) the allocated memory. The arena itself maintains a pointer to the
// last zone; the zone list is reverse-walked during arena destruction only.
Zone* last_zone_ = nullptr;
std::atomic<Zone*> last_zone_{nullptr};
// The backing memory quota
MemoryAllocator* const memory_allocator_;
};
// Smart pointer for arenas when the final size is not required.
@ -122,10 +127,11 @@ struct ScopedArenaDeleter {
void operator()(Arena* arena) { arena->Destroy(); }
};
using ScopedArenaPtr = std::unique_ptr<Arena, ScopedArenaDeleter>;
inline ScopedArenaPtr MakeScopedArena(size_t initial_size) {
return ScopedArenaPtr(Arena::Create(initial_size));
inline ScopedArenaPtr MakeScopedArena(size_t initial_size,
MemoryAllocator* memory_allocator) {
return ScopedArenaPtr(Arena::Create(initial_size, memory_allocator));
}
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_ARENA_H */
#endif /* GRPC_CORE_LIB_RESOURCE_QUOTA_ARENA_H */

@ -29,9 +29,9 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"

@ -21,10 +21,10 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/security/credentials/credentials.h"
extern grpc_core::DebugOnlyTraceFlag grpc_trace_auth_context_refcount;

@ -45,11 +45,11 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_split.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/slice/slice_utils.h"
@ -362,7 +362,8 @@ grpc_error_handle grpc_call_create(const grpc_call_create_args* args,
call_and_stack_size + (args->parent ? sizeof(child_call) : 0);
std::pair<grpc_core::Arena*, void*> arena_with_call =
grpc_core::Arena::CreateWithAlloc(initial_size, call_alloc_size);
grpc_core::Arena::CreateWithAlloc(initial_size, call_alloc_size,
&*args->channel->allocator);
arena = arena_with_call.first;
call = new (arena_with_call.second) grpc_call(arena, *args);
*out_call = call;

@ -26,7 +26,7 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/server.h"

@ -41,6 +41,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/resource_quota/api.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
@ -59,7 +60,7 @@ static void destroy_channel(void* arg, grpc_error_handle error);
grpc_channel* grpc_channel_create_with_builder(
grpc_channel_stack_builder* builder,
grpc_channel_stack_type channel_stack_type, grpc_error_handle* error) {
char* target = gpr_strdup(grpc_channel_stack_builder_get_target(builder));
std::string target = grpc_channel_stack_builder_get_target(builder);
grpc_channel_args* args = grpc_channel_args_copy(
grpc_channel_stack_builder_get_channel_arguments(builder));
grpc_channel* channel;
@ -68,6 +69,7 @@ grpc_channel* grpc_channel_create_with_builder(
} else {
GRPC_STATS_INC_CLIENT_CHANNELS_CREATED();
}
std::string name = grpc_channel_stack_builder_get_target(builder);
grpc_error_handle builder_error = grpc_channel_stack_builder_finish(
builder, sizeof(grpc_channel), 1, destroy_channel, nullptr,
reinterpret_cast<void**>(&channel));
@ -80,13 +82,15 @@ grpc_channel* grpc_channel_create_with_builder(
} else {
GRPC_ERROR_UNREF(builder_error);
}
gpr_free(target);
grpc_channel_args_destroy(args);
return nullptr;
}
channel->target = target;
channel->target.Init(std::move(target));
channel->is_client = grpc_channel_stack_type_is_client(channel_stack_type);
channel->registration_table.Init();
channel->allocator.Init(grpc_core::ResourceQuotaFromChannelArgs(args)
->memory_quota()
->CreateMemoryOwner(name));
gpr_atm_no_barrier_store(
&channel->call_size_estimate,
@ -197,11 +201,10 @@ void CreateChannelzNode(grpc_channel_stack_builder* builder) {
const bool is_internal_channel = grpc_channel_args_find_bool(
args, GRPC_ARG_CHANNELZ_IS_INTERNAL_CHANNEL, false);
// Create the channelz node.
const char* target = grpc_channel_stack_builder_get_target(builder);
std::string target = grpc_channel_stack_builder_get_target(builder);
grpc_core::RefCountedPtr<grpc_core::channelz::ChannelNode> channelz_node =
grpc_core::MakeRefCounted<grpc_core::channelz::ChannelNode>(
target != nullptr ? target : "", channel_tracer_max_memory,
is_internal_channel);
target.c_str(), channel_tracer_max_memory, is_internal_channel);
channelz_node->AddTraceEvent(
grpc_core::channelz::ChannelTrace::Severity::Info,
grpc_slice_from_static_string("Channel created"));
@ -313,7 +316,7 @@ void grpc_channel_update_call_size_estimate(grpc_channel* channel,
char* grpc_channel_get_target(grpc_channel* channel) {
GRPC_API_TRACE("grpc_channel_get_target(channel=%p)", 1, (channel));
return gpr_strdup(channel->target);
return gpr_strdup(channel->target->c_str());
}
void grpc_channel_get_info(grpc_channel* channel,
@ -486,7 +489,8 @@ static void destroy_channel(void* arg, grpc_error_handle /*error*/) {
}
grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CHANNEL(channel));
channel->registration_table.Destroy();
gpr_free(channel->target);
channel->allocator.Destroy();
channel->target.Destroy();
gpr_free(channel);
// See comment in grpc_channel_create() for why we do this.
grpc_shutdown();

@ -110,8 +110,9 @@ struct grpc_channel {
grpc_core::ManualConstructor<grpc_core::CallRegistrationTable>
registration_table;
grpc_core::RefCountedPtr<grpc_core::channelz::ChannelNode> channelz_node;
grpc_core::ManualConstructor<grpc_core::MemoryAllocator> allocator;
char* target;
grpc_core::ManualConstructor<std::string> target;
};
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack*)((c) + 1))

@ -24,13 +24,13 @@
#include <stddef.h>
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/byte_stream.h"
#include "src/core/lib/transport/connectivity_state.h"

@ -410,7 +410,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/gpr/tmpfile_posix.cc',
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/arena.cc',
'src/core/lib/gprpp/examine_stack.cc',
'src/core/lib/gprpp/fork.cc',
'src/core/lib/gprpp/global_config_env.cc',
@ -528,6 +527,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/profiling/stap_timers.cc',
'src/core/lib/promise/activity.cc',
'src/core/lib/resource_quota/api.cc',
'src/core/lib/resource_quota/arena.cc',
'src/core/lib/resource_quota/memory_quota.cc',
'src/core/lib/resource_quota/resource_quota.cc',
'src/core/lib/resource_quota/thread_quota.cc',

@ -114,15 +114,15 @@ static void chttp2_init_client_socketpair(
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
cs.client_args = client_args;
cs.f = f;
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
grpc_channel_args_destroy(client_args);
client_setup_transport(&cs, transport);
grpc_channel_args_destroy(client_args);
GPR_ASSERT(f->client);
}

@ -125,15 +125,15 @@ static void chttp2_init_client_socketpair(
auto* fixture_data = static_cast<custom_fixture_data*>(f->fixture_data);
grpc_transport* transport;
sp_client_setup cs;
cs.client_args = client_args;
cs.f = f;
client_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(client_args);
cs.client_args = client_args;
cs.f = f;
transport =
grpc_create_chttp2_transport(client_args, fixture_data->ep.client, true);
grpc_channel_args_destroy(client_args);
client_setup_transport(&cs, transport);
grpc_channel_args_destroy(client_args);
GPR_ASSERT(f->client);
}

@ -189,7 +189,8 @@ static void do_connect(void* arg, grpc_error_handle error) {
core_server->channel_args(), server, false);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"SetupTransport",
core_server->SetupTransport(transport, nullptr, nullptr, nullptr)));
core_server->SetupTransport(transport, nullptr,
core_server->channel_args(), nullptr)));
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, fc->closure, GRPC_ERROR_NONE);

@ -62,9 +62,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
args = grpc_channel_args_copy_and_add(nullptr, &authority_arg, 1);
grpc_channel* channel = grpc_channel_create(
"test-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport, nullptr);
const grpc_channel_args* channel_args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel* channel =
grpc_channel_create("test-target", channel_args,
GRPC_CLIENT_DIRECT_CHANNEL, transport, nullptr);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(channel_args);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call* call = grpc_channel_create_call(
channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host,

@ -58,11 +58,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
.PreconditionChannelArgs(nullptr);
grpc_transport* transport =
grpc_create_chttp2_transport(channel_args, mock_endpoint, false);
grpc_channel_args_destroy(channel_args);
grpc_resource_quota_unref(resource_quota);
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"SetupTransport", grpc_core::Server::FromC(server)->SetupTransport(
transport, nullptr, nullptr, nullptr)));
transport, nullptr, channel_args, nullptr)));
grpc_channel_args_destroy(channel_args);
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
grpc_call* call1 = nullptr;

@ -16,7 +16,7 @@
*
*/
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/resource_quota/arena.h"
#include <inttypes.h>
#include <string.h>
@ -32,11 +32,16 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/test_config.h"
using grpc_core::Arena;
static void test_noop(void) { Arena::Create(1)->Destroy(); }
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static void test_noop(void) { Arena::Create(1, g_memory_allocator)->Destroy(); }
static void test(const char* name, size_t init_size, const size_t* allocs,
size_t nallocs) {
@ -50,7 +55,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs,
std::string s = absl::StrJoin(parts, "");
gpr_log(GPR_INFO, "%s", s.c_str());
Arena* a = Arena::Create(init_size);
Arena* a = Arena::Create(init_size, g_memory_allocator);
void** ps = static_cast<void**>(gpr_zalloc(sizeof(*ps) * nallocs));
for (size_t i = 0; i < nallocs; i++) {
ps[i] = a->Alloc(allocs[i]);
@ -96,7 +101,7 @@ static void concurrent_test(void) {
concurrent_test_args args;
gpr_event_init(&args.ev_start);
args.arena = Arena::Create(1024);
args.arena = Arena::Create(1024, g_memory_allocator);
grpc_core::Thread thds[CONCURRENT_TEST_THREADS];

@ -306,6 +306,7 @@ grpc_cc_test(
deps = [
"//:chunked_vector",
"//:gpr_base",
"//:resource_quota",
"//test/core/util:grpc_suppressions",
],
)
@ -320,6 +321,7 @@ grpc_proto_fuzzer(
uses_polling = False,
deps = [
"//:chunked_vector",
"//:resource_quota",
"//test/core/util:grpc_test_util",
],
)

@ -15,12 +15,17 @@
#include <vector>
#include "src/core/lib/gprpp/chunked_vector.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/gprpp/chunked_vector_fuzzer.pb.h"
bool squelch = true;
bool leak_check = true;
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static constexpr size_t kChunkSize = 17;
using IntHdl = std::shared_ptr<int>;
@ -139,7 +144,7 @@ class Fuzzer {
return &vectors_.emplace(index, Comparison(arena_.get())).first->second;
}
ScopedArenaPtr arena_ = MakeScopedArena(128);
ScopedArenaPtr arena_ = MakeScopedArena(128, g_memory_allocator);
std::map<int, Comparison> vectors_;
};
} // namespace grpc_core

@ -16,20 +16,25 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
namespace grpc_core {
namespace testing {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
static constexpr size_t kInitialArenaSize = 1024;
static constexpr size_t kChunkSize = 3;
TEST(ChunkedVector, Noop) {
auto arena = MakeScopedArena(kInitialArenaSize);
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
ChunkedVector<int, kChunkSize> v(arena.get());
EXPECT_EQ(0, v.size());
}
TEST(ChunkedVector, Stack) {
auto arena = MakeScopedArena(kInitialArenaSize);
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
ChunkedVector<int, kChunkSize> v(arena.get());
// Populate 2 chunks of memory, and 2/3 of a final chunk.
@ -71,7 +76,7 @@ TEST(ChunkedVector, Stack) {
}
TEST(ChunkedVector, Iterate) {
auto arena = MakeScopedArena(kInitialArenaSize);
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
v.EmplaceBack(2);
@ -103,7 +108,7 @@ TEST(ChunkedVector, Iterate) {
}
TEST(ChunkedVector, ConstIterate) {
auto arena = MakeScopedArena(kInitialArenaSize);
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
v.EmplaceBack(2);
@ -135,7 +140,7 @@ TEST(ChunkedVector, ConstIterate) {
}
TEST(ChunkedVector, Clear) {
auto arena = MakeScopedArena(kInitialArenaSize);
auto arena = MakeScopedArena(kInitialArenaSize, g_memory_allocator);
ChunkedVector<int, kChunkSize> v(arena.get());
v.EmplaceBack(1);
EXPECT_EQ(v.size(), 1);

@ -75,6 +75,7 @@ grpc_cc_test(
uses_polling = False,
deps = [
"//:arena_promise",
"//:resource_quota",
"//test/core/util:grpc_suppressions",
],
)

@ -18,10 +18,15 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
namespace grpc_core {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
TEST(ArenaPromiseTest, AllocatedWorks) {
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
int x = 42;
ArenaPromise<int> p(arena.get(), [x] { return Poll<int>(x); });
EXPECT_EQ(p(), Poll<int>(42));
@ -30,7 +35,7 @@ TEST(ArenaPromiseTest, AllocatedWorks) {
}
TEST(ArenaPromiseTest, DestructionWorks) {
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
auto x = std::make_shared<int>(42);
auto p = ArenaPromise<int>(arena.get(), [x] { return Poll<int>(*x); });
ArenaPromise<int> q(std::move(p));

@ -32,9 +32,14 @@
#include <grpcpp/security/binder_security_policy.h>
#include "src/core/ext/transport/binder/transport/binder_stream.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/transport/binder/mock_objects.h"
#include "test/core/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
namespace grpc_binder {
namespace {
@ -45,7 +50,8 @@ using ::testing::Return;
class BinderTransportTest : public ::testing::Test {
public:
BinderTransportTest()
: arena_(grpc_core::Arena::Create(/* initial_size = */ 1)),
: arena_(grpc_core::Arena::Create(/* initial_size = */ 1,
g_memory_allocator)),
transport_(grpc_create_binder_transport_client(
absl::make_unique<NiceMock<MockBinder>>(),
std::make_shared<
@ -211,7 +217,8 @@ struct MakeSendInitialMetadata {
std::vector<grpc_linked_mdelem> storage;
grpc_linked_mdelem method_ref_storage;
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
};
@ -243,7 +250,8 @@ struct MakeSendTrailingMetadata {
&grpc_trailing_metadata;
}
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
};
@ -266,7 +274,8 @@ struct MakeRecvInitialMetadata {
~MakeRecvInitialMetadata() {}
MockGrpcClosure ready;
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
absl::Notification notification;
};
@ -309,7 +318,8 @@ struct MakeRecvTrailingMetadata {
~MakeRecvTrailingMetadata() {}
MockGrpcClosure ready;
grpc_core::ScopedArenaPtr arena = grpc_core::MakeScopedArena(1024);
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
absl::Notification notification;
};

@ -21,6 +21,7 @@
#include "src/core/ext/transport/binder/transport/binder_transport.h"
#include "src/core/ext/transport/binder/wire_format/wire_reader_impl.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/error_utils.h"
@ -107,14 +108,16 @@ std::shared_ptr<grpc::Channel> BinderChannelForTesting(
} // namespace end2end_testing
} // namespace grpc_binder
grpc_channel* grpc_binder_channel_create_for_testing(grpc_server* server,
grpc_channel_args* args,
void* /*reserved*/) {
grpc_channel* grpc_binder_channel_create_for_testing(
grpc_server* server, const grpc_channel_args* args, void* /*reserved*/) {
grpc_core::ExecCtx exec_ctx;
grpc_arg default_authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test.authority"));
args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(args);
grpc_channel_args* client_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
@ -128,6 +131,7 @@ grpc_channel* grpc_binder_channel_create_for_testing(grpc_server* server,
grpc_channel_create("binder", client_args, GRPC_CLIENT_DIRECT_CHANNEL,
client_transport, &error);
GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_channel_args_destroy(args);
grpc_channel_args_destroy(client_args);
return channel;
}

@ -35,8 +35,7 @@ std::shared_ptr<grpc::Channel> BinderChannelForTesting(
} // namespace end2end_testing
} // namespace grpc_binder
grpc_channel* grpc_binder_channel_create_for_testing(grpc_server* server,
grpc_channel_args* args,
void* /*reserved*/);
grpc_channel* grpc_binder_channel_create_for_testing(
grpc_server* server, const grpc_channel_args* args, void* /*reserved*/);
#endif // GRPC_TEST_CORE_TRANSPORT_BINDER_END2END_TESTING_CHANNEL_CREATE_H

@ -32,6 +32,7 @@
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/ext/transport/chttp2/transport/hpack_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/transport/metadata.h"
@ -41,6 +42,10 @@
#define TEST(x) run_test(x, #x)
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
grpc_core::HPackCompressor* g_compressor;
int g_failure = 0;
@ -161,7 +166,7 @@ static void verify(const verify_params params, const char* expected,
va_list l;
grpc_linked_mdelem* e =
static_cast<grpc_linked_mdelem*>(gpr_malloc(sizeof(*e) * nheaders));
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
va_start(l, nheaders);
@ -244,7 +249,7 @@ static void test_basic_headers() {
static void verify_continuation_headers(const char* key, const char* value,
bool is_eof) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_slice_buffer output;
grpc_mdelem elem = grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string(key)),
@ -327,7 +332,7 @@ static void test_decode_table_overflow() {
static void verify_table_size_change_match_elem_size(const char* key,
const char* value,
bool use_true_binary) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_slice_buffer output;
grpc_mdelem elem = grpc_mdelem_from_slices(
grpc_slice_intern(grpc_slice_from_static_string(key)),

@ -25,6 +25,7 @@
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/transport/chttp2/hpack_parser_fuzzer.pb.h"
@ -38,10 +39,13 @@ DEFINE_PROTO_FUZZER(const hpack_parser_fuzzer::Msg& msg) {
grpc_test_only_set_slice_hash_seed(0);
if (squelch) gpr_set_log_function(dont_log);
grpc_init();
auto memory_allocator = grpc_core::ResourceQuota::Default()
->memory_quota()
->CreateMemoryAllocator("test-allocator");
{
std::unique_ptr<grpc_core::HPackParser> parser(new grpc_core::HPackParser);
for (int i = 0; i < msg.frames_size(); i++) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_core::ExecCtx exec_ctx;
grpc_metadata_batch b(arena.get());

@ -26,10 +26,15 @@
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
struct TestInput {
const char* input;
const char* expected_parse;
@ -67,7 +72,7 @@ class ParseTest : public ::testing::TestWithParam<Test> {
void TestVector(grpc_slice_split_mode mode, const char* hexstring,
std::string expect) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_core::ExecCtx exec_ctx;
grpc_slice input = parse_hexstring(hexstring);
grpc_slice* slices;

@ -16,6 +16,7 @@
#include <gtest/gtest.h>
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "test/core/util/test_config.h"
@ -23,18 +24,21 @@
namespace grpc_core {
namespace testing {
static auto* g_memory_allocator = new MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
TEST(MetadataMapTest, Noop) {
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
MetadataMap<>(arena.get());
}
TEST(MetadataMapTest, NoopWithDeadline) {
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
MetadataMap<GrpcTimeoutMetadata>(arena.get());
}
TEST(MetadataMapTest, SimpleOps) {
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
EXPECT_EQ(map.get_pointer(GrpcTimeoutMetadata()), nullptr);
EXPECT_EQ(map.get(GrpcTimeoutMetadata()), absl::nullopt);
@ -70,7 +74,7 @@ class FakeEncoder {
TEST(MetadataMapTest, EmptyEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
map.Encode(&encoder);
EXPECT_EQ(encoder.output(), "");
@ -78,7 +82,7 @@ TEST(MetadataMapTest, EmptyEncodeTest) {
TEST(MetadataMapTest, TimeoutEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024);
auto arena = MakeScopedArena(1024, g_memory_allocator);
MetadataMap<GrpcTimeoutMetadata> map(arena.get());
map.Set(GrpcTimeoutMetadata(), 1234);
map.Encode(&encoder);

@ -35,6 +35,7 @@
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/static_metadata.h"
@ -43,6 +44,10 @@
/* a large number */
#define MANY 10000
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static grpc_slice maybe_intern(grpc_slice in, bool intern) {
grpc_slice out = intern ? grpc_slice_intern(in) : grpc_slice_ref(in);
grpc_slice_unref(in);
@ -308,7 +313,7 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) {
}
static void test_grpc_metadata_batch_get_value_with_absent_key(void) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch metadata(arena.get());
std::string concatenated_value;
absl::optional<absl::string_view> value =
@ -319,7 +324,7 @@ static void test_grpc_metadata_batch_get_value_with_absent_key(void) {
static void test_grpc_metadata_batch_get_value_returns_one_value(void) {
const char* kKey = "some_key";
const char* kValue = "some_value";
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_linked_mdelem storage;
grpc_metadata_batch metadata(arena.get());
storage.md = grpc_mdelem_from_slices(
@ -337,7 +342,7 @@ static void test_grpc_metadata_batch_get_value_returns_multiple_values(void) {
const char* kKey = "some_key";
const char* kValue1 = "value1";
const char* kValue2 = "value2";
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_linked_mdelem storage1;
grpc_linked_mdelem storage2;
grpc_metadata_batch metadata(arena.get());
@ -357,7 +362,7 @@ static void test_grpc_metadata_batch_get_value_returns_multiple_values(void) {
}
static void test_grpc_chttp2_incoming_metadata_replace_or_add_works(void) {
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch buffer(arena.get());
GRPC_LOG_IF_ERROR("incoming_buffer_add",
buffer.Append(grpc_mdelem_from_slices(

@ -56,7 +56,10 @@ class EvaluateArgsTestUtil {
}
private:
ScopedArenaPtr arena_ = MakeScopedArena(1024);
MemoryAllocator allocator_ =
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"EvaluateArgsTestUtil");
ScopedArenaPtr arena_ = MakeScopedArena(1024, &allocator_);
grpc_metadata_batch metadata_{arena_.get()};
MockAuthorizationEndpoint endpoint_{/*local_uri=*/"", /*peer_uri=*/""};
grpc_auth_context auth_context_{nullptr};

@ -20,22 +20,27 @@
#include <benchmark/benchmark.h>
#include "src/core/lib/gprpp/arena.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
using grpc_core::Arena;
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static void BM_Arena_NoOp(benchmark::State& state) {
for (auto _ : state) {
Arena::Create(state.range(0))->Destroy();
Arena::Create(state.range(0), g_memory_allocator)->Destroy();
}
}
BENCHMARK(BM_Arena_NoOp)->Range(1, 1024 * 1024);
static void BM_Arena_ManyAlloc(benchmark::State& state) {
Arena* a = Arena::Create(state.range(0));
Arena* a = Arena::Create(state.range(0), g_memory_allocator);
const size_t realloc_after =
1024 * 1024 * 1024 / ((state.range(1) + 15) & 0xffffff0u);
while (state.KeepRunning()) {
@ -43,7 +48,7 @@ static void BM_Arena_ManyAlloc(benchmark::State& state) {
// periodically recreate arena to avoid OOM
if (state.iterations() % realloc_after == 0) {
a->Destroy();
a = Arena::Create(state.range(0));
a = Arena::Create(state.range(0), g_memory_allocator);
}
}
a->Destroy();
@ -52,7 +57,7 @@ BENCHMARK(BM_Arena_ManyAlloc)->Ranges({{1, 1024 * 1024}, {1, 32 * 1024}});
static void BM_Arena_Batch(benchmark::State& state) {
for (auto _ : state) {
Arena* a = Arena::Create(state.range(0));
Arena* a = Arena::Create(state.range(0), g_memory_allocator);
for (int i = 0; i < state.range(1); i++) {
a->Alloc(state.range(2));
}

@ -39,8 +39,10 @@
#include "src/core/ext/filters/message_size/message_size_filter.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/transport_impl.h"
#include "src/cpp/client/create_channel_internal.h"
@ -49,6 +51,10 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
void BM_Zalloc(benchmark::State& state) {
// speed of light for call creation is zalloc, so benchmark a few interesting
// sizes
@ -535,13 +541,14 @@ static void BM_IsolatedFilter(benchmark::State& state) {
TestOp test_op_data;
const int kArenaSize = 4096;
grpc_call_context_element context[GRPC_CONTEXT_COUNT] = {};
grpc_call_element_args call_args{call_stack,
grpc_call_element_args call_args{
call_stack,
nullptr,
context,
method,
start_time,
deadline,
grpc_core::Arena::Create(kArenaSize),
grpc_core::Arena::Create(kArenaSize, g_memory_allocator),
nullptr};
while (state.KeepRunning()) {
GPR_TIMER_SCOPE("BenchmarkCycle", 0);
@ -554,7 +561,8 @@ static void BM_IsolatedFilter(benchmark::State& state) {
// recreate arena every 64k iterations to avoid oom
if (0 == (state.iterations() & 0xffff)) {
call_args.arena->Destroy();
call_args.arena = grpc_core::Arena::Create(kArenaSize);
call_args.arena =
grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
}
}
call_args.arena->Destroy();
@ -696,9 +704,13 @@ class IsolatedCallFixture : public TrackCounters {
// the grpc_shutdown() run by grpc_channel_destroy(). So we need to
// call grpc_init() manually here to balance things out.
grpc_init();
const grpc_channel_args* args = grpc_core::CoreConfiguration::Get()
.channel_args_preconditioning()
.PreconditionChannelArgs(nullptr);
grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
grpc_channel_stack_builder_set_name(builder, "phony");
grpc_channel_stack_builder_set_target(builder, "phony_target");
grpc_channel_stack_builder_set_channel_arguments(builder, args);
GPR_ASSERT(grpc_channel_stack_builder_append_filter(
builder, &isolated_call_filter::isolated_call_filter, nullptr,
nullptr));
@ -708,6 +720,7 @@ class IsolatedCallFixture : public TrackCounters {
nullptr);
}
cq_ = grpc_completion_queue_create_for_next(nullptr);
grpc_channel_args_destroy(args);
}
void Finish(benchmark::State& state) override {

@ -30,6 +30,7 @@
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/transport/metadata_batch.h"
@ -39,6 +40,10 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
static grpc_slice MakeSlice(std::vector<uint8_t> bytes) {
grpc_slice s = grpc_slice_malloc(bytes.size());
uint8_t* p = GRPC_SLICE_START_PTR(s);
@ -69,7 +74,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
grpc_millis saved_now = grpc_core::ExecCtx::Get()->Now();
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
b.Set(grpc_core::GrpcTimeoutMetadata(), saved_now + 30 * 1000);
@ -111,7 +116,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
grpc_core::ExecCtx exec_ctx;
static bool logged_representative_output = false;
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
Fixture::Prepare(&b);
@ -468,7 +473,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
std::vector<grpc_slice> benchmark_slices = Fixture::GetBenchmarkSlices();
grpc_core::HPackParser p;
const int kArenaSize = 4096 * 4096;
auto* arena = grpc_core::Arena::Create(kArenaSize);
auto* arena = grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
grpc_core::ManualConstructor<grpc_metadata_batch> b;
b.Init(arena);
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
@ -489,7 +494,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
if (0 == (state.iterations() & 0xfff)) {
b.Destroy();
arena->Destroy();
arena = grpc_core::Arena::Create(kArenaSize);
arena = grpc_core::Arena::Create(kArenaSize, g_memory_allocator);
b.Init(arena);
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
grpc_core::HPackParser::Boundary::None,

@ -41,6 +41,10 @@
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
static auto* g_memory_allocator = new grpc_core::MemoryAllocator(
grpc_core::ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"test"));
////////////////////////////////////////////////////////////////////////////////
// Helper classes
//
@ -196,7 +200,7 @@ class Stream {
explicit Stream(Fixture* f) : f_(f) {
stream_size_ = grpc_transport_stream_size(f->transport());
stream_ = gpr_malloc(stream_size_);
arena_ = grpc_core::Arena::Create(4096);
arena_ = grpc_core::Arena::Create(4096, g_memory_allocator);
}
~Stream() {
@ -212,7 +216,7 @@ class Stream {
memset(stream_, 0, stream_size_);
if ((state.iterations() & 0xffff) == 0) {
arena_->Destroy();
arena_ = grpc_core::Arena::Create(4096);
arena_ = grpc_core::Arena::Create(4096, g_memory_allocator);
}
grpc_transport_init_stream(f_->transport(),
static_cast<grpc_stream*>(stream_), &refcount_,
@ -333,7 +337,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) {
op.payload = &op_payload;
};
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
Metadata::Prepare(&b);
@ -430,7 +434,7 @@ static void BM_TransportStreamSend(benchmark::State& state) {
grpc_slice send_slice = grpc_slice_malloc_large(state.range(0));
memset(GRPC_SLICE_START_PTR(send_slice), 0, GRPC_SLICE_LENGTH(send_slice));
grpc_core::ManualConstructor<grpc_core::SliceBufferByteStream> send_stream;
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);
@ -564,7 +568,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) {
op.payload = &op_payload;
};
auto arena = grpc_core::MakeScopedArena(1024);
auto arena = grpc_core::MakeScopedArena(1024, g_memory_allocator);
grpc_metadata_batch b(arena.get());
RepresentativeClientInitialMetadata::Prepare(&b);

@ -1841,8 +1841,6 @@ src/core/lib/gpr/tmpfile_posix.cc \
src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/useful.h \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/arena.h \
src/core/lib/gprpp/atomic_utils.h \
src/core/lib/gprpp/bitset.h \
src/core/lib/gprpp/chunked_vector.h \
@ -2082,6 +2080,8 @@ src/core/lib/promise/race.h \
src/core/lib/promise/seq.h \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/api.h \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/arena.h \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/memory_quota.h \
src/core/lib/resource_quota/resource_quota.cc \

@ -1639,8 +1639,6 @@ src/core/lib/gpr/tmpfile_windows.cc \
src/core/lib/gpr/useful.h \
src/core/lib/gpr/wrap_memcpy.cc \
src/core/lib/gprpp/README.md \
src/core/lib/gprpp/arena.cc \
src/core/lib/gprpp/arena.h \
src/core/lib/gprpp/atomic_utils.h \
src/core/lib/gprpp/bitset.h \
src/core/lib/gprpp/chunked_vector.h \
@ -1881,6 +1879,8 @@ src/core/lib/promise/race.h \
src/core/lib/promise/seq.h \
src/core/lib/resource_quota/api.cc \
src/core/lib/resource_quota/api.h \
src/core/lib/resource_quota/arena.cc \
src/core/lib/resource_quota/arena.h \
src/core/lib/resource_quota/memory_quota.cc \
src/core/lib/resource_quota/memory_quota.h \
src/core/lib/resource_quota/resource_quota.cc \

Loading…
Cancel
Save