sched/kconfig: add PIDHASH_INITIAL_LENGTH
Summary
sched/Kconfig: add PIDHASH_INITIAL_LENGTH option
This adds the flexibility to configure pid hash table length. It allows to provision the table right at once for cases where number of threads are known at design time.
Impact
None
Testing
- Local test with
rv-virt/nshandrv-virt/nsh64 - CI checking
@xiaoxiang781216 and @acassis
Looks like CI system breaks?
Configuration/Tool: smartl-c906/sotest
------------------------------------------------------------------------------------
Cleaning...
Configuring...
Building NuttX...
riscv-none-elf-ld: dynload.o: ABI is incompatible with that of the selected emulation:
target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
riscv-none-elf-ld: failed to merge target specific data of file dynload.o
riscv-none-elf-ld: warning: cannot find entry symbol _start; defaulting to 00010074
make[4]: *** [Makefile:45: dynload] Error 1
With stock toolchain gcc-riscv64-unknown-elf on Ubuntu 22.04, this config can be built with makefile locally, maybe I am using a not so recent version.
please rebase, that PR was reverted
@yf13 How about restore the restrictions of CONFIG_MAX_TASKS?
#4117
There are two benefits:
- avoid accessing memory allocators
- same benefits as
PIDHASH_INITIAL_LENGTH, andCONFIG_MAX_TASKSis more concise and easy to understand
@yf13 How about restore the restrictions of
CONFIG_MAX_TASKS? #4117There are two benefits:
- avoid accessing memory allocators
- same benefits as
PIDHASH_INITIAL_LENGTH, andCONFIG_MAX_TASKSis more concise and easy to understand
but not all products can easily predicate the accuracy number of threads required by runtime. PIDHASH_INITIAL_LENGTH plus the static array could satisfy both usages.
but not all products can easily predicate the accuracy number of threads required by runtime. PIDHASH_INITIAL_LENGTH plus the static array could satisfy both usages.
Yes, what I mean is not to completely remove the dynamic alloc of g_pidhash, just add the maximum number of tasks in deterministic design time.
#if CONFIG_MAX_TASKS == 0
FAR struct tcb_s **g_pidhash;
#else
FAR struct tcb_s g_pidhash[CONFIG_MAX_TASKS];
#endif
@anchao as current approach already supports both static and dyanmic pid ranges, maybe we can stick with it and just see if there are better names?
Other names I can tell are: INITIAL_PID_LIMIT, INITIAL_PID_RANGE etc. For cases where max pid is known at design time, simply set it in INITIAL_PID_LIMIT.
@anchao as current approach already supports both static and dyanmic pid ranges, maybe we can stick with it and just see if there are better names?
Other names I can tell are:
INITIAL_PID_LIMIT,INITIAL_PID_RANGEetc. For cases where max pid is known at design time, simply set it inINITIAL_PID_LIMIT.
@yf13 Let's keep this name for now, I mainly want to eliminate allocator access, but which should not be implemented in this PR. Please address @xiaoxiang781216 comments.
@anchao, eliminating allocator use during boot time is a large topic that can be discussed separately. my purpose is just to achieve leakless ostest.
Also thanks for reminding as I didn't see the in-place comments from gh command line, here I use gh most time as browser access to github is too unstable. In my latest update, I've renamed the config as INITIAL_PID_LIMIT and also addressed @xiaoxiang781216's comments.
@anchao, how do you find out patch 4117 from commit 00cf12b? I don't see a method in gh pr command.
Looks like CI is broken? Got below from Linux (arm-01):
Configuration/Tool: ntosd-dm320/udp,CONFIG_ARM_TOOLCHAIN_GNU_EABI
------------------------------------------------------------------------------------
Cleaning...
Configuring...
Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
Enabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
Building NuttX...
make[1]: *** No rule to make target '/github/workspace/sources/nuttx/.config'.
make[1]: Failed to remake makefile '/github/workspace/sources/nuttx/.config'.
make: *** [tools/Unix.mk:268: tools/cnvwindeps] Error 2
@anchao, how do you find out patch 4117 from commit
00cf12b? I don't see a method ingh prcommand.
@yf13 You could type .patch at the end of the URL and refresh the URL or press enter to go the URL if you just want the patch file:
https://github.com/apache/nuttx/pull/4117.patch
@anchao, thanks for teach this URL rule. If I get commit id 00cf12b from my local repo (e.g. via git blame), how can I find the PR number 4117 which includes that commit from Github?
@yf13 I'm not familiar with how to search the PR in the CLI, for website maybe you can search for commit id in nuttx repo to get out the corresponding PR:
@anchao, many thanks! I tried the web search, now both 4117 and this PR are returned. It is so nice of you!
@yf13 another you to test a PR without downloading and applying it manually:
git fetch upstream pull/1234/head
git checkout FETCH_HEAD
Assuming 1234 is the number your PR
More info: https://acassis.wordpress.com/2022/02/24/how-to-test-a-pr-before-it-get-integrated-on-nuttx/
@acassis thanks for the git tips! guess it is the thing behind gh pr checkout 1234.
Unfortunately I can't access wordpress in China, will check them later when there are chances.