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

[NXP K32W] Reduce heap usage by reducing event queue length #17979

Merged

Conversation

tcarmelveilleux
Copy link
Contributor

@tcarmelveilleux tcarmelveilleux commented May 2, 2022

Problem

Issue #9261

  • K32W platform ran out of BSS last week, and had to reduce heap size
  • Current usage is default max 100 events in queue. PR Reduce RAM usage from CHIPDeviceEvent #17959 already reduced
    the size of each event and saved approx 600 bytes. This PR should reduce it
    further.
  • This change reduces the maximum amount of heap that could be used by events, to save more heap headroom

Change overview

  • This PR moves max queue size from 100 to 75, which is 25% reduction
    and much larger than some platforms which use 25 (which seems low to me)

  • Other Thread platforms like QPG and EFR32 run on 25, so not worried here

Testing

Issue project-chip#9261

- K32W platform ran out of BSS last week
- Current usage is default max 100 events in queue. PR project-chip#17959 already reduced
  the size of each event and saved approx 600 bytes. This PR should reduce it
  further.

- This PR moves max queue size from 100 to 75, which is 25% reduction
  and much larger than some platforms which use 25 (which seems low to me)

- Other Thread platforms like QPG and EFR32 run on 25, so not worried here

Testing done:
- Sanity check on K32W via @doru91
@github-actions
Copy link

github-actions bot commented May 2, 2022

PR #17979: Size comparison from 769264a to d16b702

Full report (34 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 769264a d16b702 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 688903 688903 0 0.0
(read/write) 163352 163352 0 0.0
.bss 75236 75236 0 0.0
.data 3400 3400 0 0.0
.rodata 102303 102303 0 0.0
.text 586116 586116 0 0.0
lock-ftd LP_CC2652R7 (read only) 676759 676759 0 0.0
(read/write) 166752 166752 0 0.0
.bss 73548 73548 0 0.0
.data 3224 3224 0 0.0
.rodata 94359 94359 0 0.0
.text 581920 581920 0 0.0
lock-mtd LP_CC2652R7 (read only) 625519 625519 0 0.0
(read/write) 146352 146352 0 0.0
.bss 69268 69268 0 0.0
.data 3224 3224 0 0.0
.rodata 94247 94247 0 0.0
.text 530784 530784 0 0.0
pump-app LP_CC2652R7 (read only) 661267 661267 0 0.0
(read/write) 183484 183484 0 0.0
.bss 73764 73764 0 0.0
.data 3256 3256 0 0.0
.rodata 80387 80387 0 0.0
.text 580396 580396 0 0.0
pump-controller-app LP_CC2652R7 (read only) 654163 654163 0 0.0
(read/write) 190388 190388 0 0.0
.bss 73820 73820 0 0.0
.data 3220 3220 0 0.0
.rodata 83323 83323 0 0.0
.text 570356 570356 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 626362 626362 0 0.0
.app_xip_area 528896 528896 0 0.0
.bss 80116 80116 0 0.0
.data 696 696 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 625074 625074 0 0.0
.app_xip_area 529072 529072 0 0.0
.bss 78692 78692 0 0.0
.data 660 660 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 574210 574210 0 0.0
.app_xip_area 468588 468588 0 0.0
.bss 88016 88016 0 0.0
.data 572 572 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 908184 908184 0 0.0
(read/write) 134528 134528 0 0.0
.bss 132472 132472 0 0.0
.data 2052 2052 0 0.0
.text 908176 908176 0 0.0
BRD4161A+rpc (read only) 942528 942528 0 0.0
(read/write) 151208 151208 0 0.0
.bss 148952 148952 0 0.0
.data 2256 2256 0 0.0
.text 942520 942520 0 0.0
BRD4161A+rs911x (read only) 746548 746548 0 0.0
(read/write) 128752 128752 0 0.0
.bss 126772 126772 0 0.0
.data 1980 1980 0 0.0
.text 746540 746540 0 0.0
lock-app BRD4161A+wf200 (read only) 916560 916560 0 0.0
(read/write) 127540 127540 0 0.0
.bss 125604 125604 0 0.0
.data 1936 1936 0 0.0
.text 916552 916552 0 0.0
window-app BRD4161A (read only) 845416 845416 0 0.0
(read/write) 132616 132616 0 0.0
.bss 130648 130648 0 0.0
.data 1964 1964 0 0.0
.text 845408 845408 0 0.0
esp32 all-clusters-app c3devkit (read only) 999682 999682 0 0.0
(read/write) 1474506 1474506 0 0.0
.dram0.bss 68376 68376 0 0.0
.dram0.data 14428 14428 0 0.0
.flash.rodata 207248 207248 0 0.0
.flash.text 999682 999682 0 0.0
.iram0.text 62020 62020 0 0.0
m5stack (read only) 1054807 1054807 0 0.0
(read/write) 476936 476936 0 0.0
.dram0.bss 73896 73896 0 0.0
.dram0.data 34176 34176 0 0.0
.flash.rodata 237028 237028 0 0.0
.flash.text 1049423 1049423 0 0.0
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 684236 684236 0 0.0
.bss 81320 81320 0 0.0
.data 2008 2008 0 0.0
.text 599204 599204 0 0.0
lock k32w061+release (read/write) 729036 729036 0 0.0
.bss 81744 81744 0 0.0
.data 1968 1968 0 0.0
.text 643620 643620 0 0.0
linux all-clusters-app debug (read only) 2729929 2729929 0 0.0
(read/write) 173144 173144 0 0.0
.bss 83360 83360 0 0.0
.data 2000 2000 0 0.0
.data.rel.ro 81656 81656 0 0.0
.dynamic 608 608 0 0.0
.got 4464 4464 0 0.0
.init 27 27 0 0.0
.init_array 1008 1008 0 0.0
.rodata 235173 235173 0 0.0
.text 2320130 2320130 0 0.0
bridge-app debug+rpc (read only) 1885025 1885025 0 0.0
(read/write) 120440 120440 0 0.0
.bss 71360 71360 0 0.0
.data 3424 3424 0 0.0
.data.rel.ro 40312 40312 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 160449 160449 0 0.0
.text 1602178 1602178 0 0.0
chip-tool debug (read only) 8976293 8976293 0 0.0
(read/write) 576464 576464 0 0.0
.bss 22592 22592 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 546472 546472 0 0.0
.dynamic 624 624 0 0.0
.got 4952 4952 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 463189 463189 0 0.0
.text 7189957 7189957 0 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 8816212 8816212 0 0.0
(read/write) 642641 642641 0 0.0
.bss 40913 40913 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 581752 581752 0 0.0
.dynamic 560 560 0 0.0
.got 14960 14960 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 430900 430900 0 0.0
.text 6926804 6926804 0 0.0
lighting-app debug+rpc (read only) 2319385 2319385 0 0.0
(read/write) 151392 151392 0 0.0
.bss 73408 73408 0 0.0
.data 1984 1984 0 0.0
.data.rel.ro 70248 70248 0 0.0
.dynamic 608 608 0 0.0
.got 4320 4320 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 184617 184617 0 0.0
.text 1968514 1968514 0 0.0
lock-app debug (read only) 2225601 2225601 0 0.0
(read/write) 145976 145976 0 0.0
.bss 72032 72032 0 0.0
.data 1504 1504 0 0.0
.data.rel.ro 66760 66760 0 0.0
.dynamic 592 592 0 0.0
.got 4312 4312 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 194353 194353 0 0.0
.text 1871346 1871346 0 0.0
ota-provider-app debug (read only) 2054241 2054241 0 0.0
(read/write) 138992 138992 0 0.0
.bss 71424 71424 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 60104 60104 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 175099 175099 0 0.0
.text 1722018 1722018 0 0.0
ota-requestor-app debug (read only) 2085297 2085297 0 0.0
(read/write) 141800 141800 0 0.0
.bss 72064 72064 0 0.0
.data 1928 1928 0 0.0
.data.rel.ro 62184 62184 0 0.0
.dynamic 592 592 0 0.0
.got 4320 4320 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 171372 171372 0 0.0
.text 1755314 1755314 0 0.0
shell debug (read only) 2554985 2554985 0 0.0
(read/write) 197104 197104 0 0.0
.bss 114088 114088 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 75920 75920 0 0.0
.dynamic 592 592 0 0.0
.got 4184 4184 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 216722 216722 0 0.0
.text 2176738 2176738 0 0.0
thermostat-no-ble arm64 (read only) 2360916 2360916 0 0.0
(read/write) 174593 174593 0 0.0
.bss 86273 86273 0 0.0
.data 1496 1496 0 0.0
.data.rel.ro 79048 79048 0 0.0
.dynamic 560 560 0 0.0
.got 4736 4736 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 145828 145828 0 0.0
.text 1985936 1985936 0 0.0
tv-app debug (read only) 2840833 2840833 0 0.0
(read/write) 276608 276608 0 0.0
.bss 189272 189272 0 0.0
.data 4640 4640 0 0.0
.data.rel.ro 76456 76456 0 0.0
.dynamic 592 592 0 0.0
.got 4696 4696 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 217163 217163 0 0.0
.text 2441618 2441618 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2418124 2418124 0 0.0
.bss 205884 205884 0 0.0
.data 5856 5856 0 0.0
.text 1380724 1380724 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1177691 1177691 0 0.0
bss 139600 139600 0 0.0
rodata 150804 150804 0 0.0
text 808632 808632 0 0.0
p6 all-clusters-app default (read/write) 2528576 2528576 0 0.0
.bss 139256 139256 0 0.0
.data 2792 2792 0 0.0
.text 1486840 1486840 0 0.0
light-app default (read/write) 2419176 2419176 0 0.0
.bss 132720 132720 0 0.0
.data 2592 2592 0 0.0
.text 1377440 1377440 0 0.0
lock-app default (read/write) 2428464 2428464 0 0.0
.bss 132544 132544 0 0.0
.data 2552 2552 0 0.0
.text 1386728 1386728 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 804440 804440 0 0.0
bss 72232 72232 0 0.0
noinit 40416 40416 0 0.0
text 571258 571258 0 0.0

@tcarmelveilleux tcarmelveilleux changed the title [NXP K32W] Save RAM by reducing event queue length [NXP K32W] Reduce heap usage by reducing event queue length May 3, 2022
@doru91
Copy link
Contributor

doru91 commented May 3, 2022

Tested with success a commissioning flow. Please note that this will help with heap usage reduction, as the event queue is dynamically allocated.

Thanks for this PR, @tcarmelveilleux

@andy31415 andy31415 merged commit c52dc86 into project-chip:master May 3, 2022
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.

5 participants