1
0
Fork 0
forked from nuttx/nuttx-update

binfmt/libelf, libs/libc/modlib: Optimize elf load speed: (1) Don't zero out memory, (2) Reduce the initial buffer size to 32 bytes.

This commit is contained in:
Xiang Xiao 2019-01-26 11:34:40 -06:00 committed by Gregory Nutt
parent 264a7164bc
commit 0edcd6b85e
9 changed files with 8 additions and 22 deletions

View file

@ -17,12 +17,12 @@ config ELF_STACKSIZE
config ELF_BUFFERSIZE
int "ELF I/O Buffer Size"
default 128
default 32
---help---
This is an I/O buffer that is used to access the ELF file. Variable length items
will need to be read (such as symbol names). This is really just this initial
size of the buffer; it will be reallocated as necessary to hold large symbol
names). Default: 128
names). Default: 32
config ELF_BUFFERINCR
int "ELF I/O Buffer Realloc Increment"

View file

@ -131,7 +131,7 @@ int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t textsize,
#else
/* Allocate memory to hold the ELF image */
loadinfo->textalloc = (uintptr_t)kumm_zalloc(textsize + datasize);
loadinfo->textalloc = (uintptr_t)kumm_malloc(textsize + datasize);
if (!loadinfo->textalloc)
{
return -ENOMEM;

View file

@ -63,10 +63,6 @@
# undef CONFIG_ELF_DUMPBUFFER
#endif
#ifndef CONFIG_ELF_BUFFERSIZE
# define CONFIG_ELF_BUFFERSIZE 128
#endif
#ifdef CONFIG_ELF_DUMPBUFFER
# define elf_dumpbuffer(m,b,n) binfodumpbuffer(m,b,n)
#else

View file

@ -53,10 +53,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_ELF_BUFFERINCR
# define CONFIG_ELF_BUFFERINCR 32
#endif
/****************************************************************************
* Private Constant Data
****************************************************************************/

View file

@ -65,7 +65,7 @@
#endif
#ifndef CONFIG_ELF_BUFFERSIZE
# define CONFIG_ELF_BUFFERSIZE 128
# define CONFIG_ELF_BUFFERSIZE 32
#endif
#ifndef CONFIG_ELF_BUFFERINCR

View file

@ -62,7 +62,7 @@
#endif
#ifndef CONFIG_MODLIB_BUFFERSIZE
# define CONFIG_MODLIB_BUFFERSIZE 128
# define CONFIG_MODLIB_BUFFERSIZE 32
#endif
#ifndef CONFIG_MODLIB_BUFFERINCR

View file

@ -33,12 +33,12 @@ config MODLIB_ALIGN_LOG2
config MODLIB_BUFFERSIZE
int "Module I/O Buffer Size"
default 128
default 32
---help---
This is an I/O buffer that is used to access the module file.
Variable length items will need to be read (such as symbol names).
This is really just this initial size of the buffer; it will be
reallocated as necessary to hold large symbol names). Default: 128
reallocated as necessary to hold large symbol names). Default: 32
config MODLIB_BUFFERINCR
int "Module I/O Buffer Realloc Increment"

View file

@ -261,7 +261,7 @@ int modlib_load(FAR struct mod_loadinfo_s *loadinfo)
/* Allocate memory to hold the ELF image */
loadinfo->textalloc = (uintptr_t)lib_zalloc(loadinfo->textsize + loadinfo->datasize);
loadinfo->textalloc = (uintptr_t)lib_malloc(loadinfo->textsize + loadinfo->datasize);
if (!loadinfo->textalloc)
{
berr("ERROR: Failed to allocate memory for the module\n");

View file

@ -52,12 +52,6 @@
* Pre-processor Definitions
****************************************************************************/
/* Amount to reallocate buffer when buffer is full */
#ifndef CONFIG_MODLIB_BUFFERINCR
# define CONFIG_MODLIB_BUFFERINCR 32
#endif
/* Return values search for exported modules */
#define SYM_NOT_FOUND 0