diff options
author | Denys Vlasenko | 2020-12-14 18:49:23 +0100 |
---|---|---|
committer | Denys Vlasenko | 2020-12-14 18:54:30 +0100 |
commit | c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa (patch) | |
tree | 9ad109d5999444dfb3a281678b6b63d2570a76cd /include/libbb.h | |
parent | fd3c512f88d43e6633bd3c3110cfa0bb321adaa8 (diff) | |
download | busybox-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.zip busybox-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.tar.gz |
libbb: add and use infrastructure for fixed page size optimization
function old new delta
procps_scan 1121 1118 -3
getpagesize 6 - -6
rpm_main 1037 1027 -10
rpm2cpio_main 120 110 -10
ptok 38 21 -17
time_main 1282 1261 -21
mkswap_main 317 278 -39
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/6 up/down: 0/-106) Total: -106 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h index a74b311..db5bf7a 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -391,6 +391,24 @@ void *mmap_read(int fd, size_t size) FAST_FUNC; void *mmap_anon(size_t size) FAST_FUNC; void *xmmap_anon(size_t size) FAST_FUNC; +#if defined(__x86_64__) || defined(i386) +# define BB_ARCH_FIXED_PAGESIZE 4096 +#else /* if defined(ARCH) */ +/* add you favorite arch today! */ +#endif + +#if defined BB_ARCH_FIXED_PAGESIZE +# define IF_VARIABLE_ARCH_PAGESIZE(...) /*nothing*/ +# define bb_getpagesize() BB_ARCH_FIXED_PAGESIZE +# define INIT_PAGESIZE(var) ((void)0) +# define cached_pagesize(var) BB_ARCH_FIXED_PAGESIZE +#else +# define IF_VARIABLE_ARCH_PAGESIZE(...) __VA_ARGS__ +# define bb_getpagesize() getpagesize() +# define INIT_PAGESIZE(var) ((var) = getpagesize()) +# define cached_pagesize(var) (var) +#endif + //TODO: supply a pointer to char[11] buffer (avoid statics)? extern const char *bb_mode_string(mode_t mode) FAST_FUNC; |