about summary refs log tree commit diff
path: root/src/unistd/read.c
diff options
context:
space:
mode:
authorAlexander Monakov <amonakov@ispras.ru>2017-12-16 14:27:25 +0300
committerRich Felker <dalias@aerifal.cx>2018-04-11 15:37:44 -0400
commit424eab2225ff3f8e3ae9f9eec9dacf2f68b71a2f (patch)
tree892438e5ca17e4bb4c990593a47357dd467cb553 /src/unistd/read.c
parent10e4bd3780050e75b72aac5d85c31816419bb17d (diff)
downloadmusl-424eab2225ff3f8e3ae9f9eec9dacf2f68b71a2f.tar.gz
musl-424eab2225ff3f8e3ae9f9eec9dacf2f68b71a2f.tar.xz
musl-424eab2225ff3f8e3ae9f9eec9dacf2f68b71a2f.zip
optimize malloc0
Implementation of __malloc0 in malloc.c takes care to preserve zero
pages by overwriting only non-zero data. However, malloc must have
already modified auxiliary heap data just before and beyond the
allocated region, so we know that edge pages need not be preserved.

For allocations smaller than one page, pass them immediately to memset.
Otherwise, use memset to handle partial pages at the head and tail of
the allocation, and scan complete pages in the interior. Optimize the
scanning loop by processing 16 bytes per iteration and handling rest of
page via memset as soon as a non-zero byte is found.
Diffstat (limited to 'src/unistd/read.c')
0 files changed, 0 insertions, 0 deletions