forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sched: adjust the scheduling strategy
1 Only the idle task can have the flag TCB_FLAG_CPU_LOCKED. According to the code logic, btcb cannot be an idle task, so this check can be removed. 2 Optimized the preemption logic check and removed the call to nxsched_add_prioritized. 3 Speed up the scheduling time while avoiding the potential for tasks to be moved multiple times between g_assignedtasks and g_readytorun. 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>
- Loading branch information
Showing
3 changed files
with
140 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/**************************************************************************** | ||
* sched/sched/queue.h | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. The | ||
* ASF licenses this file to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
****************************************************************************/ | ||
|
||
#ifndef __INCLUDE_SCHED_SCHED_NUTTX_QUEUE_H | ||
#define __INCLUDE_SCHED_SCHED_NUTTX_QUEUE_H | ||
|
||
/**************************************************************************** | ||
* Included Files | ||
****************************************************************************/ | ||
|
||
#include <nuttx/queue.h> | ||
|
||
/**************************************************************************** | ||
* Pre-processor Definitions | ||
****************************************************************************/ | ||
|
||
#define dq_addfirst_nonempty(p, q) \ | ||
do \ | ||
{ \ | ||
FAR dq_entry_t *tmp_node = (p); \ | ||
tmp_node->blink = NULL; \ | ||
tmp_node->flink = (q)->head; \ | ||
(q)->head->blink = tmp_node; \ | ||
(q)->head = tmp_node; \ | ||
} \ | ||
while (0) | ||
|
||
#define dq_rem_head(p, q) \ | ||
do \ | ||
{ \ | ||
FAR dq_entry_t *tmp_node = (p); \ | ||
FAR dq_entry_t *tmp_next = tmp_node->flink; \ | ||
(q)->head = tmp_next; \ | ||
tmp_next->blink = NULL; \ | ||
tmp_node->flink = NULL; \ | ||
} \ | ||
while (0) | ||
|
||
#define dq_rem_mid(p) \ | ||
do \ | ||
{ \ | ||
FAR dq_entry_t *tmp_prev = (FAR dq_entry_t *)p->blink; \ | ||
FAR dq_entry_t *tmp_next = (FAR dq_entry_t *)p->flink; \ | ||
tmp_prev->flink = tmp_next; \ | ||
tmp_next->blink = tmp_prev; \ | ||
} \ | ||
while (0) | ||
|
||
#endif /* __INCLUDE_NUTTX_QUEUE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters