Skip to content

Commit 4682e8d

Browse files
authored
Changes HttpSM to be Proxy Allocated (#8082)
1 parent 170e12b commit 4682e8d

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

iocore/eventsystem/I_Thread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class Thread
122122
ProxyAllocator http1ClientSessionAllocator;
123123
ProxyAllocator http2ClientSessionAllocator;
124124
ProxyAllocator http2StreamAllocator;
125+
ProxyAllocator httpSMAllocator;
125126
ProxyAllocator quicClientSessionAllocator;
126127
ProxyAllocator httpServerSessionAllocator;
127128
ProxyAllocator hdrHeapAllocator;

proxy/ProxyTransaction.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#define HttpTxnDebug(fmt, ...) SsnDebug(this, "http_txn", fmt, __VA_ARGS__)
2828

29+
extern ClassAllocator<HttpSM> httpSMAllocator;
30+
2931
ProxyTransaction::ProxyTransaction(ProxySession *session) : VConnection(nullptr), _proxy_ssn(session) {}
3032

3133
ProxyTransaction::~ProxyTransaction()
@@ -43,7 +45,7 @@ ProxyTransaction::new_transaction(bool from_early_data)
4345
// connection re-use
4446

4547
ink_release_assert(_proxy_ssn != nullptr);
46-
_sm = HttpSM::allocate();
48+
_sm = THREAD_ALLOC(httpSMAllocator, this_thread());
4749
_sm->init(from_early_data);
4850
HttpTxnDebug("[%" PRId64 "] Starting transaction %d using sm [%" PRId64 "]", _proxy_ssn->connection_id(),
4951
_proxy_ssn->get_transact_count(), _sm->sm_id);

proxy/http/HttpSM.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void
375375
HttpSM::destroy()
376376
{
377377
cleanup();
378-
httpSMAllocator.free(this);
378+
THREAD_FREE(this, httpSMAllocator, this_thread());
379379
}
380380

381381
void

proxy/http/HttpSM.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,6 @@ HttpSM::get_cache_sm()
703703
return cache_sm;
704704
}
705705

706-
inline HttpSM *
707-
HttpSM::allocate()
708-
{
709-
extern ClassAllocator<HttpSM> httpSMAllocator;
710-
return httpSMAllocator.alloc();
711-
}
712-
713706
inline int
714707
HttpSM::write_response_header_into_buffer(HTTPHdr *h, MIOBuffer *b)
715708
{

src/traffic_server/InkAPITest.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8696,11 +8696,13 @@ std::array<std::string_view, TS_CONFIG_LAST_ENTRY> SDK_Overridable_Configs = {
86968696
"proxy.config.hostdb.ip_resolve",
86978697
"proxy.config.http.connect.dead.policy"}};
86988698

8699+
extern ClassAllocator<HttpSM> httpSMAllocator;
8700+
86998701
REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
87008702
{
87018703
TSOverridableConfigKey key;
87028704
TSRecordDataType type;
8703-
HttpSM *s = HttpSM::allocate();
8705+
HttpSM *s = THREAD_ALLOC(httpSMAllocator, this_thread());
87048706
bool success = true;
87058707
TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
87068708
InkRand generator(17);
@@ -8804,7 +8806,7 @@ REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype
88048806

88058807
REGRESSION_TEST(SDK_API_TXN_HTTP_INFO_GET)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
88068808
{
8807-
HttpSM *s = HttpSM::allocate();
8809+
HttpSM *s = THREAD_ALLOC(httpSMAllocator, this_thread());
88088810
bool success = true;
88098811
TSHttpTxn txnp = reinterpret_cast<TSHttpTxn>(s);
88108812
TSMgmtInt ival_read;

0 commit comments

Comments
 (0)