You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/01/18 03:02:26 UTC

[nuttx] 01/03: group_leave: Don't instantiate address environment prior to destroying it

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6a026382f03712cbf7afe336d4f62519ba8d97e7
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Tue Jan 17 16:20:19 2023 +0200

    group_leave: Don't instantiate address environment prior to destroying it
    
    This is just unnecessary, a process cannot be destroyed by another
    process in any case, every time this is executed the active address
    environment is the process getting destroyed.
    
    Even in the hypothetical case this was possible, the system would
    crash at once if a context switch happens between "select()" and
    "restore()", which is possible as the granule allocator is protected by
    a semaphore (which is a synchronization point).
---
 sched/group/group_leave.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c
index 16d92caf1e..9ae913073d 100644
--- a/sched/group/group_leave.c
+++ b/sched/group/group_leave.c
@@ -129,7 +129,6 @@ static void group_remove(FAR struct task_group_s *group)
 static inline void group_release(FAR struct task_group_s *group)
 {
 #ifdef CONFIG_ARCH_ADDRENV
-  save_addrenv_t oldenv;
   int i;
 #endif
 
@@ -203,10 +202,6 @@ static inline void group_release(FAR struct task_group_s *group)
 #endif
 
 #ifdef CONFIG_ARCH_ADDRENV
-  /* Switch the addrenv and also save the current addrenv */
-
-  up_addrenv_select(&group->tg_addrenv, &oldenv);
-
   /* Destroy the group address environment */
 
   up_addrenv_destroy(&group->tg_addrenv);
@@ -220,10 +215,6 @@ static inline void group_release(FAR struct task_group_s *group)
           g_group_current[i] = NULL;
         }
     }
-
-  /* Restore the previous addrenv */
-
-  up_addrenv_restore(&oldenv);
 #endif
 
 #if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)