Does numactl preallocate pages when run like "numactl --length=<size>--file <filename> --interleave=all --touch"?

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux
  • numactl

Issue

  • Does numactl preallocate pages when run like "numactl --length=--file --interleave=all --touch"?

Resolution

Pages do get allocated.

# numactl --length=50M --file /dev/shm/new --interleave=all --touch

File size is set.

# ls /dev/shm/new
-rw------- 1 root root 52428800 Jun  7 07:07 /dev/shm/new
# du -csh /dev/shm/new
51M /dev/shm/new
51M total

Following is an strace collected on the numactl command,

07:13:28.728203 open("/dev/shm/new", O_RDONLY) = -1 ENOENT (No such file or directory)
07:13:28.728255 open("/dev/shm/new", O_RDWR|O_CREAT, 0600) = 3
07:13:28.728308 fstat(3, {st_dev=makedev(0, 19), st_ino=1766350, st_mode=S_IFREG|0600, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=0, st_size=0, st_atime=2012/06/07-07:13:28, st_mtime=2012/06/07-07:13:28, st_ctime=2012/06/07-07:13:28}) = 0
07:13:28.728374 ftruncate(3, 52428800)  = 0 <----------------------------------------------------- here the file is being truncated to 50MB
07:13:28.728418 mmap(NULL, 52428800, PROT_READ, MAP_SHARED, 3, 0) = 0x2b5edb301000 <-------------- here the file is mapped into memory.
07:13:28.728466 get_mempolicy(NULL, {}, 0, 0, 0) = 0
07:13:28.728509 mbind(47686404280320, 52428800, MPOL_INTERLEAVE, 0x7fff3251e8d0, 129, 0) = 0
07:13:28.799536 exit_group(0)           = ?

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments