Skip to content

Commit

Permalink
nshlib/nsh_fileapps.c: Remove sched_lock() from nsh_fileapp()
Browse files Browse the repository at this point in the history
Locking the scheduler prior to calling posix_spawn() might lock the
scheduler for a relatively long time, if the file to be loaded is large.

posix_spawn() loads the process into memory, possibly linking it as well
if the binary format is linkable (elf). This can take tens / hundreds of
milliseconds, which basically destroys the OS's real time performance.

Missing the death-of-child signal is a very trivial penalty considering
the alternative.
  • Loading branch information
pussuw committed Oct 30, 2023
1 parent 77e6c39 commit b62801d
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions nshlib/nsh_fileapps.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
}
#endif

/* Lock the scheduler in an attempt to prevent the application from
* running until waitpid() has been called.
*/

sched_lock();

/* Execute the program. posix_spawnp returns a positive errno value on
* failure.
*/
Expand Down Expand Up @@ -296,8 +290,6 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
#endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */
}

sched_unlock();

/* Free attributes and file actions. Ignoring return values in the case
* of an error.
*/
Expand Down

0 comments on commit b62801d

Please sign in to comment.