Commit Graph

26 Commits

Author SHA1 Message Date
hujun5 e13d255345 sched: add nxsched_remove_self
reason:
1In the scenario of active waiting, context switching is inevitable, and we can eliminate redundant judgments.

code size
before
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ size nuttx
   text    data     bss     dec     hex filename
 262848   49985   63893  376726   5bf96 nuttx

after
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ size nuttx
   text    data     bss     dec     hex filename
 263324   49985   63893  377202   5c172 nuttx

reduce code size by  -476

Configuring NuttX and compile:
$ ./tools/configure.sh -l qemu-armv8a:nsh_smp
$ make
Running with qemu
$ qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic \
   -machine virt,virtualization=on,gic-version=3 \
   -net none -chardev stdio,id=con,mux=on -serial chardev:con \
   -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-24 22:07:00 +08:00
Alin Jerpelea eb9030c891 sched: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-12 01:10:14 +08:00
chao an 306c1c0b7d sched/tasklist: replace task status list with macro definition
replace to macro will help to extend the scheduling implementation

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-21 11:23:46 +09:00
Gregory Nutt 717bb04cb7 Increase the number of real time signals. Two is not enough.
Refer to issue #8867 for details and rational.

Convert sigset_t to an array type so that more than 32 signals can be supported.

Why not use a uin64_t?
- Using a uin32_t is more flexible if we decide to increase the number of signals beyound 64.
- 64-bit accesses are not atomic, at least not on 32-bit ARMv7-M and similar
- Keeping the base type as uint32_t does not introduce additional overhead due to padding to achieve 64-bit alignment of uin64_t
- Some architectures still supported by NuttX do not support uin64_t
  types,

Increased the number of signals to 64. This matches Linux. This will support all xsignals defined by Linux and also 32 real time signals (also like Linux).

This is is a work in progress; a draft PR that you are encouraged to comment on.
2023-03-27 16:59:04 +03:00
zhangyuan21 d8051ba979 nuttx/sched: merge up_block_task and up_unblock_task 2022-11-22 22:59:08 +08:00
zhangyuan21 08f7152d9f nuttx/sched: remove nxsched_remove_readytorun from up_block_task
It takes about 10 cycles to obtain the task list according to the task
status. In most cases, we know the task status, so we can directly
add the task from the specified task list to reduce time consuming.
2022-11-22 15:29:00 +09:00
zhangyuan21 18266c1012 nuttx/sched: use pid to check idle task
Pid is more appropriate than the flink pointer to determine idle task,
when we want to use other data structure to optimize the task list.
2022-10-31 17:53:08 +09:00
Alin Jerpelea 8935ac4cc3 sched: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can mograte the licenses
to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-09 01:21:53 -08:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt 3b22d13493 sched/: Add debug assertions before each call to up_block_task() to assure that there is no attempt to block an IDLE task. 2018-11-30 06:54:15 -06:00
Xiang Xiao 27c7974cb1 sched/signal/sig_suspend.c: sigsuspend() shouldn't eat the pending signal but dispatch all instead 2018-11-08 07:39:37 -06:00
Xiang Xiao e1202d2ed3 Replace all ASSERT with DEBUGASSERT to save the code space 2018-08-24 06:58:30 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 8198ba6a6d This change renames all internal, private NuttX signal-related functions to use the prefix nxsig_ so that they cannot be confused with application interfaces that begin, primarily, with sig_
This is analogous to similar renaming that was done previously for semaphores.

Squashed commit of the following:

    sched/signal:  Fix a few compile warnings introduced by naming changes.

    sched/signal:  Rename all private, internal signl functions to use the nxsig_ prefix.

    sched/signal:  Rename sig_removependingsignal, sig_unmaskpendingsignal, and sig_mqnotempty to nxsig_remove_pendingsignal, nxsig_unmask_pendingsignal, and nxsig_mqnotempty to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_findaction and sig_lowest to nxsig_find_action and nxsig_lowest to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_allocatepingsigaction and sig_deliver to nxsig_alloc_pendingsigaction and nxsig_deliver to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_cleanup, sig_release, sig_releasependingaction, and sig_releasependingsignal to nxsig_cleanup, nxsig_release, nxsig_release_pendingaction, and nxsig_release_pendingsignal to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_tcbdispatch and sig_dispatch to nxsig_tcbdispatch and nxsig_dispatch to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_releaseaction and sig_pendingset to nxsig_release_action and nxsig_pendingset to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_initialize and sig_allocateactionblock to nxsig_initialize and nxsig_alloc_actionblock to make it clear that these are OS internal interfaces.
2017-10-05 13:25:25 -06:00
Gregory Nutt b52e4e5ecd Move cancellation point definitions to their own header file. 2016-12-10 09:08:26 -06:00
Gregory Nutt bc3ca25cc7 Cancellation points: Close up some logic to eliminte some race conditions. 2016-12-10 08:36:58 -06:00
Gregory Nutt 7fce8022c6 Finishes all cancellation point logic 2016-12-09 16:50:34 -06:00
Gregory Nutt 6e3107650d nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section() 2016-02-14 08:17:46 -06:00
Gregory Nutt 74db48202e sched/: Replace explict references to g_readytorun with indirect references via the this_task() macro 2016-02-06 17:44:41 -06:00
Gregory Nutt 79d554939e sched/: Fix some spacing issues 2015-10-07 19:59:14 -06:00
Gregory Nutt cb9e27c3b0 Standardize naming used for public data and function groupings 2015-10-02 16:30:35 -06:00
Gregory Nutt b4423c1eed Make some file section headers more consistent with standard 2015-04-08 06:47:36 -06:00
Gregory Nutt d798dd37a7 Replace os_internal.h with sched/sched.h in files that actually reference something in sched.h 2014-08-08 17:53:55 -06:00
Gregory Nutt cb79407ced Move all pthread files from sched/ to sched/pthread 2014-08-08 12:55:02 -06:00
Gregory Nutt 0385a00a60 Move signal-related files from sched/ to sched/signal 2014-08-08 12:44:44 -06:00