mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Merged in masayuki2009/nuttx.nuttx/lc823450_smp_test (pull request #601)
lc823450 smp test
* sched/clock: Replace critical section APIs with spin lock APIs in clock_gettime.c
This change will improve performance for SMP systems but nothing
changes for non-SMP systems. (Pls see include/nuttx/irq.h)
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* sched/sched: Remove unnecessary DEBUGASSERT in sched_removereadytorun.c
In SMP mode, rtrtcb is not always at the g_readytorun.head.
This change removes DEBUGASSERT() to avoid this condition.
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
75f68b9d3a
commit
7062ca2c03
@@ -110,12 +110,12 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
|||||||
* CLOCK_MONOTONIC be introduced additional increases to systime.
|
* CLOCK_MONOTONIC be introduced additional increases to systime.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave();
|
||||||
|
|
||||||
tp->tv_sec += (uint32_t)g_monotonic_basetime.tv_sec;
|
tp->tv_sec += (uint32_t)g_monotonic_basetime.tv_sec;
|
||||||
tp->tv_nsec += (uint32_t)g_monotonic_basetime.tv_nsec;
|
tp->tv_nsec += (uint32_t)g_monotonic_basetime.tv_nsec;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(flags);
|
||||||
|
|
||||||
/* Handle carry to seconds. */
|
/* Handle carry to seconds. */
|
||||||
|
|
||||||
@@ -163,12 +163,12 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
|||||||
* was last set, this gives us the current time.
|
* was last set, this gives us the current time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave();
|
||||||
|
|
||||||
ts.tv_sec += (uint32_t)g_basetime.tv_sec;
|
ts.tv_sec += (uint32_t)g_basetime.tv_sec;
|
||||||
ts.tv_nsec += (uint32_t)g_basetime.tv_nsec;
|
ts.tv_nsec += (uint32_t)g_basetime.tv_nsec;
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(flags);
|
||||||
|
|
||||||
/* Handle carry to seconds. */
|
/* Handle carry to seconds. */
|
||||||
|
|
||||||
|
|||||||
@@ -238,8 +238,6 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb)
|
|||||||
tmptcb = (FAR struct tcb_s *)
|
tmptcb = (FAR struct tcb_s *)
|
||||||
dq_remfirst((FAR dq_queue_t *)&g_readytorun);
|
dq_remfirst((FAR dq_queue_t *)&g_readytorun);
|
||||||
|
|
||||||
DEBUGASSERT(tmptcb == rtrtcb);
|
|
||||||
|
|
||||||
dq_addfirst((FAR dq_entry_t *)tmptcb, tasklist);
|
dq_addfirst((FAR dq_entry_t *)tmptcb, tasklist);
|
||||||
|
|
||||||
tmptcb->cpu = cpu;
|
tmptcb->cpu = cpu;
|
||||||
|
|||||||
Reference in New Issue
Block a user