From 9d98177daa60759e8826e48bbb829a228e5a3d84 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 24 Jul 2015 09:54:28 -0600 Subject: [PATCH] Add logic to reset the replenish the sporadic scheduler when a task is resumed --- arch/arm/src/arm/up_unblocktask.c | 10 +++------- arch/arm/src/armv6-m/up_unblocktask.c | 10 +++------- arch/arm/src/armv7-a/arm_unblocktask.c | 10 +++------- arch/arm/src/armv7-m/up_unblocktask.c | 10 +++------- arch/avr/src/avr/up_unblocktask.c | 10 +++------- arch/avr/src/avr32/up_unblocktask.c | 10 +++------- arch/hc/src/common/up_unblocktask.c | 10 +++------- arch/mips/src/mips32/up_unblocktask.c | 10 +++------- arch/rgmp/src/nuttx.c | 10 ++++------ arch/sh/src/common/up_unblocktask.c | 10 +++------- arch/sim/src/up_unblocktask.c | 22 +++------------------- arch/x86/src/common/up_unblocktask.c | 10 +++------- arch/z16/src/common/up_unblocktask.c | 10 +++------- arch/z80/src/common/up_unblocktask.c | 10 +++------- 14 files changed, 43 insertions(+), 109 deletions(-) diff --git a/arch/arm/src/arm/up_unblocktask.c b/arch/arm/src/arm/up_unblocktask.c index 824c52a679..91dd890d3a 100644 --- a/arch/arm/src/arm/up_unblocktask.c +++ b/arch/arm/src/arm/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/arm/up_unblocktask.c * - * Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,13 +93,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/arm/src/armv6-m/up_unblocktask.c b/arch/arm/src/armv6-m/up_unblocktask.c index b42c3841d8..2389a1acac 100644 --- a/arch/arm/src/armv6-m/up_unblocktask.c +++ b/arch/arm/src/armv6-m/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv6-m/up_unblocktask.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -91,13 +91,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/arm/src/armv7-a/arm_unblocktask.c b/arch/arm/src/armv7-a/arm_unblocktask.c index 196dcf625a..8e5c48b967 100644 --- a/arch/arm/src/armv7-a/arm_unblocktask.c +++ b/arch/arm/src/armv7-a/arm_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_unblocktask.c * - * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,13 +93,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/arm/src/armv7-m/up_unblocktask.c b/arch/arm/src/armv7-m/up_unblocktask.c index bc5548e1b7..878e4a49fe 100644 --- a/arch/arm/src/armv7-m/up_unblocktask.c +++ b/arch/arm/src/armv7-m/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_unblocktask.c * - * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2012, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -92,13 +92,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/avr/src/avr/up_unblocktask.c b/arch/avr/src/avr/up_unblocktask.c index 1558af1464..b5e4478663 100644 --- a/arch/avr/src/avr/up_unblocktask.c +++ b/arch/avr/src/avr/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/avr/up_unblocktask.c * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -92,13 +92,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/avr/src/avr32/up_unblocktask.c b/arch/avr/src/avr32/up_unblocktask.c index d6e5ded763..2fd062403b 100644 --- a/arch/avr/src/avr32/up_unblocktask.c +++ b/arch/avr/src/avr32/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/avr32/up_unblocktask.c * - * Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,13 +93,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/hc/src/common/up_unblocktask.c b/arch/hc/src/common/up_unblocktask.c index 374d451edc..5a1e5bf00f 100644 --- a/arch/hc/src/common/up_unblocktask.c +++ b/arch/hc/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/hc/src/common/up_unblocktask.c * - * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,13 +93,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/mips/src/mips32/up_unblocktask.c b/arch/mips/src/mips32/up_unblocktask.c index c68a62fd70..5c4d46a90a 100644 --- a/arch/mips/src/mips32/up_unblocktask.c +++ b/arch/mips/src/mips32/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/mips32/up_unblocktask.c * - * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -95,13 +95,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/rgmp/src/nuttx.c b/arch/rgmp/src/nuttx.c index 893ee5cc9f..5b545597b3 100644 --- a/arch/rgmp/src/nuttx.c +++ b/arch/rgmp/src/nuttx.c @@ -330,14 +330,12 @@ void up_unblock_task(struct tcb_s *tcb) struct tcb_s *rtcb = current_task; /* Remove the task from the blocked task list */ + sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + /* Reset scheduler parameters */ + + sched_resume_scheduler(tcb); // Add the task in the correct location in the prioritized // g_readytorun task list. diff --git a/arch/sh/src/common/up_unblocktask.c b/arch/sh/src/common/up_unblocktask.c index 587eafe5d8..8f46a596dc 100644 --- a/arch/sh/src/common/up_unblocktask.c +++ b/arch/sh/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/sh/src/common/up_unblocktask.c * - * Copyright (C) 2008-2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -93,13 +93,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/sim/src/up_unblocktask.c b/arch/sim/src/up_unblocktask.c index 86edecbb52..39d5dd3791 100644 --- a/arch/sim/src/up_unblocktask.c +++ b/arch/sim/src/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/sim/src/up_unblocktask.c * - * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,18 +47,6 @@ #include "sched/sched.h" #include "up_internal.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -94,13 +82,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/x86/src/common/up_unblocktask.c b/arch/x86/src/common/up_unblocktask.c index 518a1f1d9c..92870c9aa6 100644 --- a/arch/x86/src/common/up_unblocktask.c +++ b/arch/x86/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/x86/src/common/up_unblocktask.c * - * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -92,13 +92,9 @@ void up_unblock_task(struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/z16/src/common/up_unblocktask.c b/arch/z16/src/common/up_unblocktask.c index ee0f003ecc..6e82ce2b8f 100644 --- a/arch/z16/src/common/up_unblocktask.c +++ b/arch/z16/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * common/up_unblocktask.c * - * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -96,13 +96,9 @@ void up_unblock_task(FAR struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list diff --git a/arch/z80/src/common/up_unblocktask.c b/arch/z80/src/common/up_unblocktask.c index 9e05ff8bb2..db613abbfe 100644 --- a/arch/z80/src/common/up_unblocktask.c +++ b/arch/z80/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/common/up_unblocktask.c * - * Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -98,13 +98,9 @@ void up_unblock_task(FAR struct tcb_s *tcb) sched_removeblocked(tcb); - /* Reset its timeslice. This is only meaningful for round - * robin tasks but it doesn't here to do it for everything - */ + /* Reset scheduler parameters */ -#if CONFIG_RR_INTERVAL > 0 - tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL); -#endif + sched_resume_scheduler(tcb); /* Add the task in the correct location in the prioritized * g_readytorun task list