[RFC PATCH] linux: add definitions for hugetlb page size encodings

Carlos Llamas cmllamas@google.com
Tue Jun 18 01:04:29 GMT 2024


On Mon, Jun 17, 2024 at 09:06:40AM +0200, Florian Weimer wrote:
> * Carlos Llamas:
> 
> > A desired hugetlb page size can be encoded in the flags parameter of
> > system calls such as mmap() and shmget(). The Linux UAPI headers have
> > included explicit definitions for these encodings since v4.14.
> >
> > This patch adds these definitions that are used along with MAP_HUGETLB
> > and SHM_HUGETLB flags as specified in the corresponding man pages. This
> > relieves programs from having to duplicate and/or compute the encodings
> > manually.
> 
> I think doing this is reasonable.  Please remove the MAP_UGE_* filter in
> sysdeps/unix/sysv/linux/tst-mman-consts.py, too.

Added to v2.

> > +/* When MAP_HUGETLB is set, bits [26:31] encode the log2 of the huge page size.
> > +   The following definitions are associated with this huge page size encoding.
> > +   It is responsibility of the application to know which sizes are supported on
> > +   the running system.  See mmap(2) man page for details. */
> 
> GNU style requires and extra space here: "details.  */”
> 
> Also applies to <bits/shm.h>.

Also added to v2.

Thanks,
Carlos Llamas


More information about the Libc-alpha mailing list