Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inet/(TCP/UDP)Endpoints: Migrate from SystemPool to BitMapObjectPool #11428

Merged
merged 2 commits into from
Nov 8, 2021

Conversation

kghost
Copy link
Contributor

@kghost kghost commented Nov 4, 2021

Problem

Use BitMapObjectPool as basic pool implementation, deprecate SystemPool, will introduce a dynamic pool later, sharing same interface as BitMapObjectPool for Linux and Darwin platform

Change overview

  • TCPEndpoints and UDPEndpoints, Migrate from SystemPool to BitMapObjectPool
  • Use ScheduleLambda instead of PostEvent, remove inet event dispatcher
  • Call Retain before queuing the endpoint into the event queue, call Release after the event is processed, remove DeferralFree

Testing

Verified using unit-tests

Copy link
Contributor

@yufengwangca yufengwangca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the consensus is to migrate all pool management to dynamic based pool, not the other way around.

We have spent huge effort to convert system pool to support dynamic allocation which can save significant memory usage on enabled platforms, we should not simply dump all of our those works without clear justification.

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

PR #11428: Size comparison from 1538bbb to 01f4929

Increases above 0.2%:

platform target config section 1538bbb 01f4929 change % change
linux all-clusters-app debug (read/write) 118656 125192 6536 5.5
.bss 50000 56592 6592 13.2
.init_array 552 560 8 1.4
bridge-app debug+rpc (read/write) 69232 75736 6504 9.4
.bss 34928 41488 6560 18.8
.init_array 408 416 8 2.0
chip-tool debug (read/write) 125864 132400 6536 5.2
.bss 18128 24720 6592 36.4
.init_array 432 440 8 1.9
lighting-app debug+rpc (read/write) 102200 108736 6536 6.4
.bss 40568 47160 6592 16.2
.init_array 536 544 8 1.5
ota-provider-app debug (read/write) 67400 73936 6536 9.7
.bss 36992 43584 6592 17.8
.init_array 448 456 8 1.8
ota-requestor-app debug (read/write) 76656 83192 6536 8.5
.bss 45120 51712 6592 14.6
.init_array 520 528 8 1.5
shell debug (read/write) 57608 64112 6504 11.3
.bss 16040 22632 6592 41.1
.init_array 344 352 8 2.3
tv-app debug (read/write) 289824 296360 6536 2.3
.bss 222640 229232 6592 3.0
.init_array 616 624 8 1.3
Increases (18 builds for linux, nrfconnect, telink)
platform target config section 1538bbb 01f4929 change % change
linux all-clusters-app debug (read only) 1703025 1704521 1496 0.1
(read/write) 118656 125192 6536 5.5
.bss 50000 56592 6592 13.2
.init_array 552 560 8 1.4
.rodata 138997 139157 160 0.1
.text 1430562 1431970 1408 0.1
bridge-app debug+rpc (read only) 1291093 1292605 1512 0.1
(read/write) 69232 75736 6504 9.4
.bss 34928 41488 6560 18.8
.init_array 408 416 8 2.0
.rodata 110852 111028 176 0.2
.text 1084325 1085733 1408 0.1
chip-tool debug (read only) 4433685 4435045 1360 0.0
(read/write) 125864 132400 6536 5.2
.bss 18128 24720 6592 36.4
.init_array 432 440 8 1.9
.rodata 226192 226328 136 0.1
.text 3939029 3940325 1296 0.0
lighting-app debug+rpc (read only) 1552089 1553585 1496 0.1
(read/write) 102200 108736 6536 6.4
.bss 40568 47160 6592 16.2
.init_array 536 544 8 1.5
.rodata 129489 129649 160 0.1
.text 1288994 1290402 1408 0.1
ota-provider-app debug (read only) 1250377 1251897 1520 0.1
(read/write) 67400 73936 6536 9.7
.bss 36992 43584 6592 17.8
.init_array 448 456 8 1.8
.rodata 112104 112288 184 0.2
.text 1042146 1043554 1408 0.1
ota-requestor-app debug (read only) 1328705 1330193 1488 0.1
(read/write) 76656 83192 6536 8.5
.bss 45120 51712 6592 14.6
.init_array 520 528 8 1.5
.rodata 124112 124264 152 0.1
.text 1106514 1107922 1408 0.1
shell debug (read only) 786873 787953 1080 0.1
(read/write) 57608 64112 6504 11.3
.bss 16040 22632 6592 41.1
.init_array 344 352 8 2.3
.rodata 77903 78031 128 0.2
.text 607458 608530 1072 0.2
tv-app debug (read only) 1815729 1817081 1352 0.1
(read/write) 289824 296360 6536 2.3
.bss 222640 229232 6592 3.0
.init_array 616 624 8 1.3
.rodata 155112 155256 144 0.1
.text 1518306 1519586 1280 0.1
nrfconnect lighting-app nrf52840dk_nrf52840 bss 111248 111252 4 0.0
nrf52840dk_nrf52840+rpc bss 107600 107604 4 0.0
nrf5340dk_nrf5340_cpuapp bss 112624 112628 4 0.0
lock-app nrf52840dk_nrf52840 bss 110284 110288 4 0.0
nrf5340dk_nrf5340_cpuapp bss 111692 111696 4 0.0
pump-app nrf52840dk_nrf52840 bss 110420 110424 4 0.0
pump-controller-app nrf52840dk_nrf52840 bss 110320 110324 4 0.0
shell nrf52840dk_nrf52840 bss 109072 109076 4 0.0
nrf5340dk_nrf5340_cpuapp bss 110052 110056 4 0.0
telink lighting-app tlsr9518adk80d bss 69064 69068 4 0.0
Decreases (18 builds for linux, nrfconnect, telink)
platform target config section 1538bbb 01f4929 change % change
linux all-clusters-app debug .data.rel.ro 62336 62272 -64 -0.1
bridge-app debug+rpc .data.rel.ro 27768 27704 -64 -0.2
chip-tool debug .data.rel.ro 100096 100032 -64 -0.1
lighting-app debug+rpc .data.rel.ro 55168 55104 -64 -0.1
ota-provider-app debug .data.rel.ro 24568 24504 -64 -0.3
ota-requestor-app debug .data.rel.ro 25576 25512 -64 -0.3
shell debug .data.rel.ro 36816 36720 -96 -0.3
tv-app debug .data.rel.ro 58824 58760 -64 -0.1
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 861303 861287 -16 -0.0
text 577624 577608 -16 -0.0
nrf52840dk_nrf52840+rpc (read/write) 823651 823635 -16 -0.0
text 551772 551756 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 786326 786310 -16 -0.0
text 507080 507052 -28 -0.0
lock-app nrf52840dk_nrf52840 (read/write) 838011 837995 -16 -0.0
text 559100 559084 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 763306 763274 -32 -0.0
text 488648 488620 -28 -0.0
pump-app nrf52840dk_nrf52840 (read/write) 844119 844103 -16 -0.0
text 563280 563264 -16 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 837863 837847 -16 -0.0
text 558836 558820 -16 -0.0
shell nrf52840dk_nrf52840 (read/write) 775755 775739 -16 -0.0
text 519664 519644 -20 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 690794 690762 -32 -0.0
text 440256 440224 -32 -0.0
telink lighting-app tlsr9518adk80d (read/write) 662982 662934 -48 -0.0
text 458134 458088 -46 -0.0
Full report (19 builds for linux, nrfconnect, telink)
platform target config section 1538bbb 01f4929 change % change
linux all-clusters-app debug (read only) 1703025 1704521 1496 0.1
(read/write) 118656 125192 6536 5.5
.bss 50000 56592 6592 13.2
.data 1042 1042 0 0.0
.data.rel.ro 62336 62272 -64 -0.1
.dynamic 592 592 0 0.0
.got 4088 4088 0 0.0
.init 27 27 0 0.0
.init_array 552 560 8 1.4
.rodata 138997 139157 160 0.1
.text 1430562 1431970 1408 0.1
bridge-app debug+rpc (read only) 1291093 1292605 1512 0.1
(read/write) 69232 75736 6504 9.4
.bss 34928 41488 6560 18.8
.data 1568 1568 0 0.0
.data.rel.ro 27768 27704 -64 -0.2
.dynamic 592 592 0 0.0
.got 3952 3952 0 0.0
.init 27 27 0 0.0
.init_array 408 416 8 2.0
.rodata 110852 111028 176 0.2
.text 1084325 1085733 1408 0.1
chip-tool debug (read only) 4433685 4435045 1360 0.0
(read/write) 125864 132400 6536 5.2
.bss 18128 24720 6592 36.4
.data 2224 2224 0 0.0
.data.rel.ro 100096 100032 -64 -0.1
.dynamic 592 592 0 0.0
.got 4368 4368 0 0.0
.init 27 27 0 0.0
.init_array 432 440 8 1.9
.rodata 226192 226328 136 0.1
.text 3939029 3940325 1296 0.0
lighting-app debug+rpc (read only) 1552089 1553585 1496 0.1
(read/write) 102200 108736 6536 6.4
.bss 40568 47160 6592 16.2
.data 1170 1170 0 0.0
.data.rel.ro 55168 55104 -64 -0.1
.dynamic 608 608 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 536 544 8 1.5
.rodata 129489 129649 160 0.1
.text 1288994 1290402 1408 0.1
ota-provider-app debug (read only) 1250377 1251897 1520 0.1
(read/write) 67400 73936 6536 9.7
.bss 36992 43584 6592 17.8
.data 752 752 0 0.0
.data.rel.ro 24568 24504 -64 -0.3
.dynamic 592 592 0 0.0
.got 4016 4016 0 0.0
.init 27 27 0 0.0
.init_array 448 456 8 1.8
.rodata 112104 112288 184 0.2
.text 1042146 1043554 1408 0.1
ota-requestor-app debug (read only) 1328705 1330193 1488 0.1
(read/write) 76656 83192 6536 8.5
.bss 45120 51712 6592 14.6
.data 816 816 0 0.0
.data.rel.ro 25576 25512 -64 -0.3
.dynamic 592 592 0 0.0
.got 3992 3992 0 0.0
.init 27 27 0 0.0
.init_array 520 528 8 1.5
.rodata 124112 124264 152 0.1
.text 1106514 1107922 1408 0.1
shell debug (read only) 786873 787953 1080 0.1
(read/write) 57608 64112 6504 11.3
.bss 16040 22632 6592 41.1
.data 242 242 0 0.0
.data.rel.ro 36816 36720 -96 -0.3
.dynamic 592 592 0 0.0
.got 3528 3528 0 0.0
.init 27 27 0 0.0
.init_array 344 352 8 2.3
.rodata 77903 78031 128 0.2
.text 607458 608530 1072 0.2
tv-app debug (read only) 1815729 1817081 1352 0.1
(read/write) 289824 296360 6536 2.3
.bss 222640 229232 6592 3.0
.data 2704 2704 0 0.0
.data.rel.ro 58824 58760 -64 -0.1
.dynamic 592 592 0 0.0
.got 4408 4408 0 0.0
.init 27 27 0 0.0
.init_array 616 624 8 1.3
.rodata 155112 155256 144 0.1
.text 1518306 1519586 1280 0.1
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 861303 861287 -16 -0.0
bss 111248 111252 4 0.0
rodata 96808 96808 0 0.0
text 577624 577608 -16 -0.0
nrf52840dk_nrf52840+rpc (read/write) 823651 823635 -16 -0.0
bss 107600 107604 4 0.0
rodata 87988 87988 0 0.0
text 551772 551756 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 786326 786310 -16 -0.0
bss 112624 112628 4 0.0
rodata 92064 92064 0 0.0
text 507080 507052 -28 -0.0
lock-app nrf52840dk_nrf52840 (read/write) 838011 837995 -16 -0.0
bss 110284 110288 4 0.0
rodata 93180 93180 0 0.0
text 559100 559084 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 763306 763274 -32 -0.0
bss 111692 111696 4 0.0
rodata 88484 88484 0 0.0
text 488648 488620 -28 -0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497323 497323 0 0.0
bss 51824 51824 0 0.0
rodata 45776 45776 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 844119 844103 -16 -0.0
bss 110420 110424 4 0.0
rodata 94888 94888 0 0.0
text 563280 563264 -16 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 837863 837847 -16 -0.0
bss 110320 110324 4 0.0
rodata 93176 93176 0 0.0
text 558836 558820 -16 -0.0
shell nrf52840dk_nrf52840 (read/write) 775755 775739 -16 -0.0
bss 109072 109076 4 0.0
rodata 72432 72432 0 0.0
text 519664 519644 -20 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 690794 690762 -32 -0.0
bss 110052 110056 4 0.0
rodata 67076 67076 0 0.0
text 440256 440224 -32 -0.0
telink lighting-app tlsr9518adk80d (read/write) 662982 662934 -48 -0.0
bss 69064 69068 4 0.0
noinit 33216 33216 0 0.0
text 458134 458088 -46 -0.0

@yufengwangca yufengwangca dismissed their stale review November 4, 2021 16:36

This is the transitional plan

@yufengwangca
Copy link
Contributor

After sync-up, this PR is the transitional change.
#11371, we separate ObjectPool into static and dynamic parts
Then we will replace the static part with BitMapObjectPool implementation
The final APIs will be same as what 11371 proposed.

#11428 is the transitional plan and Inet will temporarily use BitMapObjectPool and soon use the unified implementation with the same dynamic implementation option as now.

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

PR #11428: Size comparison from abcae0d to a6ec444

Increases above 0.2%:

platform target config section abcae0d a6ec444 change % change
efr32 lighting-app BRD4161A (read/write) 115696 116036 340 0.3
.bss 113924 114252 328 0.3
.data 1772 1780 8 0.5
BRD4161A+rpc (read/write) 132316 132652 336 0.3
.bss 130428 130756 328 0.3
.data 1888 1896 8 0.4
lock-app BRD4161A (read/write) 113516 113848 332 0.3
.bss 111780 112108 328 0.3
.data 1732 1740 8 0.5
window-app BRD4161A (read/write) 113836 114172 336 0.3
.bss 112100 112428 328 0.3
.data 1736 1744 8 0.5
p6 all-clusters-app default .bss 106824 111728 4904 4.6
.data 2520 2528 8 0.3
lock-app default .bss 95648 100552 4904 5.1
.data 2392 2400 8 0.3
qpg lighting-app qpg6100+debug .data 1004 1008 4 0.4
lock-app qpg6100+debug .data 960 964 4 0.4
persistent-storage-app qpg6100+debug .bss 18912 19064 152 0.8
.data 356 360 4 1.1
Increases (13 builds for efr32, k32w, p6, qpg, telink)
platform target config section abcae0d a6ec444 change % change
efr32 lighting-app BRD4161A (read/write) 115696 116036 340 0.3
.bss 113924 114252 328 0.3
.data 1772 1780 8 0.5
BRD4161A+rpc (read/write) 132316 132652 336 0.3
.bss 130428 130756 328 0.3
.data 1888 1896 8 0.4
lock-app BRD4161A (read/write) 113516 113848 332 0.3
.bss 111780 112108 328 0.3
.data 1732 1740 8 0.5
window-app BRD4161A (read/write) 113836 114172 336 0.3
.bss 112100 112428 328 0.3
.data 1736 1744 8 0.5
k32w lighting-app k32w061+se05x+release .bss 77784 77792 8 0.0
.data 1904 1908 4 0.2
lock-app k32w061+debug .bss 68316 68324 8 0.0
.data 1872 1876 4 0.2
shell k32w061+debug .bss 78952 78960 8 0.0
.data 1840 1844 4 0.2
p6 all-clusters-app default .bss 106824 111728 4904 4.6
.data 2520 2528 8 0.3
lock-app default .bss 95648 100552 4904 5.1
.data 2392 2400 8 0.3
qpg lighting-app qpg6100+debug (read/write) 114140 114144 4 0.0
.bss 50944 50952 8 0.0
.data 1004 1008 4 0.4
lock-app qpg6100+debug .bss 49888 49896 8 0.0
.data 960 964 4 0.4
persistent-storage-app qpg6100+debug (read only) 153212 153308 96 0.1
(read/write) 114140 114144 4 0.0
.bss 18912 19064 152 0.8
.data 356 360 4 1.1
.text 147892 147988 96 0.1
telink lighting-app tlsr9518adk80d bss 69064 69068 4 0.0
Decreases (12 builds for efr32, k32w, p6, qpg, telink)
platform target config section abcae0d a6ec444 change % change
efr32 lighting-app BRD4161A (read only) 744860 741240 -3620 -0.5
.text 744852 741232 -3620 -0.5
BRD4161A+rpc (read only) 732408 728772 -3636 -0.5
.text 732400 728764 -3636 -0.5
lock-app BRD4161A (read only) 724144 720524 -3620 -0.5
.text 724136 720516 -3620 -0.5
window-app BRD4161A (read only) 725056 721420 -3636 -0.5
.text 725048 721412 -3636 -0.5
k32w lighting-app k32w061+se05x+release (read/write) 699240 698692 -548 -0.1
.text 613752 613192 -560 -0.1
lock-app k32w061+debug (read/write) 592060 591512 -548 -0.1
.text 516072 515512 -560 -0.1
shell k32w061+debug (read/write) 657552 657004 -548 -0.1
.text 570960 570400 -560 -0.1
p6 all-clusters-app default (read/write) 2299096 2296736 -2360 -0.1
.heap 924000 919088 -4912 -0.5
.text 1257360 1255000 -2360 -0.2
lock-app default (read/write) 2212912 2210576 -2336 -0.1
.heap 935304 930392 -4912 -0.5
.text 1171176 1168840 -2336 -0.2
qpg lighting-app qpg6100+debug (read only) 490628 490048 -580 -0.1
.text 485308 484728 -580 -0.1
lock-app qpg6100+debug (read only) 466968 466388 -580 -0.1
(read/write) 114144 114140 -4 -0.0
.text 461648 461068 -580 -0.1
telink lighting-app tlsr9518adk80d (read/write) 662982 662942 -40 -0.0
text 458138 458092 -46 -0.0
Full report (13 builds for efr32, k32w, p6, qpg, telink)
platform target config section abcae0d a6ec444 change % change
efr32 lighting-app BRD4161A (read only) 744860 741240 -3620 -0.5
(read/write) 115696 116036 340 0.3
.bss 113924 114252 328 0.3
.data 1772 1780 8 0.5
.text 744852 741232 -3620 -0.5
BRD4161A+rpc (read only) 732408 728772 -3636 -0.5
(read/write) 132316 132652 336 0.3
.bss 130428 130756 328 0.3
.data 1888 1896 8 0.4
.text 732400 728764 -3636 -0.5
lock-app BRD4161A (read only) 724144 720524 -3620 -0.5
(read/write) 113516 113848 332 0.3
.bss 111780 112108 328 0.3
.data 1732 1740 8 0.5
.text 724136 720516 -3620 -0.5
window-app BRD4161A (read only) 725056 721420 -3636 -0.5
(read/write) 113836 114172 336 0.3
.bss 112100 112428 328 0.3
.data 1736 1744 8 0.5
.text 725048 721412 -3636 -0.5
k32w lighting-app k32w061+se05x+release (read/write) 699240 698692 -548 -0.1
.bss 77784 77792 8 0.0
.data 1904 1908 4 0.2
.text 613752 613192 -560 -0.1
lock-app k32w061+debug (read/write) 592060 591512 -548 -0.1
.bss 68316 68324 8 0.0
.data 1872 1876 4 0.2
.text 516072 515512 -560 -0.1
shell k32w061+debug (read/write) 657552 657004 -548 -0.1
.bss 78952 78960 8 0.0
.data 1840 1844 4 0.2
.text 570960 570400 -560 -0.1
p6 all-clusters-app default (read/write) 2299096 2296736 -2360 -0.1
.bss 106824 111728 4904 4.6
.data 2520 2528 8 0.3
.heap 924000 919088 -4912 -0.5
.text 1257360 1255000 -2360 -0.2
lock-app default (read/write) 2212912 2210576 -2336 -0.1
.bss 95648 100552 4904 5.1
.data 2392 2400 8 0.3
.heap 935304 930392 -4912 -0.5
.text 1171176 1168840 -2336 -0.2
qpg lighting-app qpg6100+debug (read only) 490628 490048 -580 -0.1
(read/write) 114140 114144 4 0.0
.bss 50944 50952 8 0.0
.data 1004 1008 4 0.4
.text 485308 484728 -580 -0.1
lock-app qpg6100+debug (read only) 466968 466388 -580 -0.1
(read/write) 114144 114140 -4 -0.0
.bss 49888 49896 8 0.0
.data 960 964 4 0.4
.text 461648 461068 -580 -0.1
persistent-storage-app qpg6100+debug (read only) 153212 153308 96 0.1
(read/write) 114140 114144 4 0.0
.bss 18912 19064 152 0.8
.data 356 360 4 1.1
.text 147892 147988 96 0.1
telink lighting-app tlsr9518adk80d (read/write) 662982 662942 -40 -0.0
bss 69064 69068 4 0.0
noinit 33216 33216 0 0.0
text 458138 458092 -46 -0.0

@kghost
Copy link
Contributor Author

kghost commented Nov 5, 2021

It looks like the +328 or +632 byes memory usage on variety platforms are due to TCPEndPoint::sPool be linked.

     632         0       632  chip::Inet::TCPEndPoint::sPool

The TCP endpoint pool is not linked previously because there is no TCP usage.

Copy link
Contributor

@msandstedt msandstedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments noted inline.

In general, this seems like it makes sense. The retain/release calls on the two sides of the queue make sense and simplifies things.

I think LwIPHandleIncomingConnection could use rework though. There's way to much reference count manipulation happening there. I honestly can't tell whether the code is correct.

Copy link
Contributor

@kpschoedel kpschoedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice simplification of LayerLwIP!

@andy31415
Copy link
Contributor

@andy31415 andy31415 merged commit 5c73522 into project-chip:master Nov 8, 2021
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 9, 2021
#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to project-chip#11428).

This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 9, 2021
#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to project-chip#11428).

This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 9, 2021
#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to project-chip#11428).

This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 9, 2021
#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to project-chip#11428).

This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.
andy31415 pushed a commit that referenced this pull request Nov 10, 2021
* Inet: Use constructors for Inet EndPoints

#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to #11428).

This is a step toward #7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.

* explicitly initialize all members
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 11, 2021
#### Problem

We have too many pool allocators.

Previous PRs (project-chip#11428, project-chip#11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from project-chip#9590)
- Add allocation selection (from project-chip#11371)
- Use this for `System::Timer` (complementing project-chip#11487)

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing project-chip#11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

CI; no changes to functionality.

CI should show `.bss` decreases corresponding to increases in project-chip#11487.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 11, 2021
#### Problem

We have too many pool allocators.

Previous PRs (project-chip#11428, project-chip#11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from project-chip#9590)
- Add allocation selection (from project-chip#11371)
- Use this for `System::Timer` (complementing project-chip#11487)

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing project-chip#11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

Added heap versions of unit tests in TestPool. (A future PR will add
`System::Object`-style statistics and re-unify most of these tests.)

CI should show `.bss` decreases corresponding to increases in project-chip#11487.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 15, 2021
#### Problem

We have too many pool allocators.

Previous PRs (project-chip#11428, project-chip#11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from project-chip#9590)
- Add allocation selection (from project-chip#11371)
- Use this for `System::Timer` (complementing project-chip#11487)

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing project-chip#11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

Added heap versions of unit tests in TestPool. (A future PR will add
`System::Object`-style statistics and re-unify most of these tests.)

CI should show `.bss` decreases corresponding to increases in project-chip#11487.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 16, 2021
#### Problem

We have too many pool allocators.

Previous PRs (project-chip#11428, project-chip#11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from project-chip#9590)
- Add allocation selection (from project-chip#11371)
- Use this for `System::Timer` (complementing project-chip#11487)

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing project-chip#11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

Added heap versions of unit tests in TestPool. (A future PR will add
`System::Object`-style statistics and re-unify most of these tests.)

CI should show `.bss` decreases corresponding to increases in project-chip#11487.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Nov 16, 2021
#### Problem

We have too many pool allocators.

Previous PRs (project-chip#11428, project-chip#11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from project-chip#9590)
- Add allocation selection (from project-chip#11371)
- Use this for `System::Timer` (complementing project-chip#11487)

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing project-chip#11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

Added heap versions of unit tests in TestPool. (A future PR will add
`System::Object`-style statistics and re-unify most of these tests.)

CI should show `.bss` decreases corresponding to increases in project-chip#11487.
kpschoedel added a commit that referenced this pull request Nov 19, 2021
#### Problem

We have too many pool allocators.

Previous PRs (#11428, #11487) transitionally use `BitMapObjectPool`
where previously `System::ObjectPool` had been used, but this lost
the ability to configure heap allocation.

#### Change overview

- Add a heap allocator (from #9590)
- Add allocation selection (from #11371)
- Use this for `System::Timer` (complementing #11487)

- Factor out common code.
- Use a heap-allocated list to track heap-allocated objects.
- More unit tests.

Co-authored-by: Zang MingJie <zealot0630@gmail.com>
Co-authored-by: C Freeman <cecille@google.com>

A future PR will use this for Inet pools (complementing #11428);
that is not done here because it would conflict with other Inet
changes under way.

#### Testing

Added heap versions of unit tests in TestPool. (A future PR will add
`System::Object`-style statistics and re-unify most of these tests.)

CI should show `.bss` decreases corresponding to increases in #11487.
PSONALl pushed a commit to PSONALl/connectedhomeip that referenced this pull request Dec 3, 2021
PSONALl pushed a commit to PSONALl/connectedhomeip that referenced this pull request Dec 3, 2021
* Inet: Use constructors for Inet EndPoints

#### Problem

`Inet::TCPEndPoint` and `Inet::UDPEndPoint` historically could not use
constructors because of `System::ObjectPool` limitations.

Incidentally renamed `mAppState` for consistency (it had been in
`System::Object` prior to project-chip#11428).

This is a step toward project-chip#7715 _Virtualize System and Inet interfaces_,
split off to reduce the complexity of an upcoming PR.

#### Change overview

Convert from `Init()` to constructors. Transitionally, the constructors
still call a per-implementation function `InitImpl()`.

#### Testing

CI; no changes to functionality.

* explicitly initialize all members
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants