Michal Hocko <mhocko@xxxxxxxxxx> wrote: <> > What does prevent you from mapping a larger area and MAP_FIXED, > PROT_NONE over it to get the protection? Yes Thanks I will try. That's good. >> > For THP, I believe, kernel already does The Right Thing™ for most users. >> > User still may want to get speific range as THP (to avoid false sharing or >> > something). >> >> I'm an OK Kernel programmer. But I was not able to create a HugePage mapping >> against /dev/shm/ in a reliable way. I think it only worked on Fedora 28/29 >> but not on any other distro/version. (MMAP_HUGE) > > Are you mixing hugetlb rather than THP? Probably. I was looking for the easiest way to get my mmap based memory allocations to be 2M based instead of 4k. to get better IO characteristics across the Kernel. But I kept getting the 4k pointers. (Can't really remember all the things I tried.) >> We run with our own compiled Kernel on various distros, THP is configured >> in but mmap against /dev/shm/ never gives me Huge pages. Does it only >> work with unanimous mmap ? (I think it is mount dependent which is not >> in the application control) > > If you are talking about THP then you have to enable huge pages for the > mapping AFAIR. This is exactly what I was looking to achieve but was not able to do. Most probably a stupid omission on my part, but just to show that it is not that trivial and strait out-of-the-man-page way to do it. (Would love a code snippet if you ever wrote one?) > -- > Michal Hocko > SUSE Labs Thanks man Boaz