Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-15 Thread Mike Kravetz
On 1/15/19 12:24 AM, Kirill A. Shutemov wrote: > On Mon, Jan 14, 2019 at 10:54:45AM -0800, Mike Kravetz wrote: >> On 1/14/19 7:35 AM, Steven Sistare wrote: >>> On 1/11/2019 6:28 PM, Mike Kravetz wrote: On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: > On Fri, Jan 11, 2019 at 08:10:03PM

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-15 Thread Kirill A. Shutemov
On Mon, Jan 14, 2019 at 10:54:45AM -0800, Mike Kravetz wrote: > On 1/14/19 7:35 AM, Steven Sistare wrote: > > On 1/11/2019 6:28 PM, Mike Kravetz wrote: > >> On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: > >>> On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: > At LPC last year,

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Steven Sistare
On 1/14/2019 1:54 PM, Mike Kravetz wrote: > On 1/14/19 7:35 AM, Steven Sistare wrote: >> On 1/11/2019 6:28 PM, Mike Kravetz wrote: >>> On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: > At LPC last year, Boaz Harrosh asked why he

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Mike Kravetz
On 1/14/19 7:35 AM, Steven Sistare wrote: > On 1/11/2019 6:28 PM, Mike Kravetz wrote: >> On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: >>> On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: At LPC last year, Boaz Harrosh asked why he had to 'jump through hoops' to get an

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Michal Hocko
On Mon 14-01-19 16:54:02, Harrosh, Boaz wrote: > Michal Hocko wrote: [...] > >> 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

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Harrosh, Boaz
Michal Hocko 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

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Harrosh, Boaz
Sistare wrote: > > A better heuristic would be to return an aligned address if the length > is a multiple of the huge page size. The gap (if any) between the end of > the previous VMA and the start of this VMA would be filled by subsequent > smaller mmap requests. The new behavior would need

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Michal Hocko
On Mon 14-01-19 16:29:29, Harrosh, Boaz wrote: > Kirill A. Shutemov wrote: > > On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote: > >> Ok, I just wanted to ask the question. I've seen application code doing > >> the 'mmap sufficiently large area' then unmap to get desired alignment >

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Harrosh, Boaz
Kirill A. Shutemov wrote: > On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote: >> Ok, I just wanted to ask the question. I've seen application code doing >> the 'mmap sufficiently large area' then unmap to get desired alignment >> trick. Was wondering if there was something we could

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Steven Sistare
On 1/11/2019 6:28 PM, Mike Kravetz wrote: > On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: >> On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: >>> At LPC last year, Boaz Harrosh asked why he had to 'jump through hoops' >>> to get an address returned by mmap() suitably aligned for THP.

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-14 Thread Kirill A. Shutemov
On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote: > Ok, I just wanted to ask the question. I've seen application code doing > the 'mmap sufficiently large area' then unmap to get desired alignment > trick. Was wondering if there was something we could do to help. Application may

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-11 Thread Mike Kravetz
On 1/11/19 1:55 PM, Kirill A. Shutemov wrote: > On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: >> At LPC last year, Boaz Harrosh asked why he had to 'jump through hoops' >> to get an address returned by mmap() suitably aligned for THP. It seems >> that if mmap is asking for a

Re: [RFC PATCH] mm: align anon mmap for THP

2019-01-11 Thread Kirill A. Shutemov
On Fri, Jan 11, 2019 at 08:10:03PM +, Mike Kravetz wrote: > At LPC last year, Boaz Harrosh asked why he had to 'jump through hoops' > to get an address returned by mmap() suitably aligned for THP. It seems > that if mmap is asking for a mapping length greater than huge page > size, it should

[RFC PATCH] mm: align anon mmap for THP

2019-01-11 Thread Mike Kravetz
At LPC last year, Boaz Harrosh asked why he had to 'jump through hoops' to get an address returned by mmap() suitably aligned for THP. It seems that if mmap is asking for a mapping length greater than huge page size, it should align the returned address to huge page size. THP alignment has