Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Mel Gorman
On Thu, Feb 01, 2018 at 01:27:30PM +0300, Kirill A. Shutemov wrote: > > It's non-trivial to do this because at minimum a page fault has to check > > if there is a potential promotion candidate by checking the PTEs around > > the faulting address searching for a correctly-aligned base page that is

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Mel Gorman
On Thu, Feb 01, 2018 at 01:27:30PM +0300, Kirill A. Shutemov wrote: > > It's non-trivial to do this because at minimum a page fault has to check > > if there is a potential promotion candidate by checking the PTEs around > > the faulting address searching for a correctly-aligned base page that is

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Kirill A. Shutemov
On Thu, Jan 25, 2018 at 09:13:03PM +, Mel Gorman wrote: > On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > > >> It's not really about memory scarcity but a more efficient use of it. > > >> Applications may want hugepage benefits without requiring any changes to > > >> app code

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Kirill A. Shutemov
On Thu, Jan 25, 2018 at 09:13:03PM +, Mel Gorman wrote: > On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > > >> It's not really about memory scarcity but a more efficient use of it. > > >> Applications may want hugepage benefits without requiring any changes to > > >> app code

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Mel Gorman
On Wed, Jan 31, 2018 at 05:09:48PM -0800, Nitin Gupta wrote: > > > > It's non-trivial to do this because at minimum a page fault has to check > > if there is a potential promotion candidate by checking the PTEs around > > the faulting address searching for a correctly-aligned base page that is >

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-02-01 Thread Mel Gorman
On Wed, Jan 31, 2018 at 05:09:48PM -0800, Nitin Gupta wrote: > > > > It's non-trivial to do this because at minimum a page fault has to check > > if there is a potential promotion candidate by checking the PTEs around > > the faulting address searching for a correctly-aligned base page that is >

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-31 Thread Nitin Gupta
On 01/25/2018 01:13 PM, Mel Gorman wrote: > On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: It's not really about memory scarcity but a more efficient use of it. Applications may want hugepage benefits without requiring any changes to app code which is what THP is

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-31 Thread Nitin Gupta
On 01/25/2018 01:13 PM, Mel Gorman wrote: > On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: It's not really about memory scarcity but a more efficient use of it. Applications may want hugepage benefits without requiring any changes to app code which is what THP is

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Andrea Arcangeli
On Thu, Jan 25, 2018 at 10:58:32AM +0100, Michal Hocko wrote: > Ohh, absolutely. And that is why we have changed the default in upstream > 444eb2a449ef ("mm: thp: set THP defrag by default to madvise and add a > stall-free defrag option") Agreed, that direct compaction change should already

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Andrea Arcangeli
On Thu, Jan 25, 2018 at 10:58:32AM +0100, Michal Hocko wrote: > Ohh, absolutely. And that is why we have changed the default in upstream > 444eb2a449ef ("mm: thp: set THP defrag by default to madvise and add a > stall-free defrag option") Agreed, that direct compaction change should already

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Andrea Arcangeli
On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > I'm trying to address many different THP issues and memory bloat is > first among them. You quoted redis in an earlier email, the redis issue has nothing to do with MADV_DONTNEED. I can quickly explain the redis issue. Redis uses

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Andrea Arcangeli
On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > I'm trying to address many different THP issues and memory bloat is > first among them. You quoted redis in an earlier email, the redis issue has nothing to do with MADV_DONTNEED. I can quickly explain the redis issue. Redis uses

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Mel Gorman
On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > >> It's not really about memory scarcity but a more efficient use of it. > >> Applications may want hugepage benefits without requiring any changes to > >> app code which is what THP is supposed to provide, while still avoiding > >>

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Mel Gorman
On Thu, Jan 25, 2018 at 11:41:03AM -0800, Nitin Gupta wrote: > >> It's not really about memory scarcity but a more efficient use of it. > >> Applications may want hugepage benefits without requiring any changes to > >> app code which is what THP is supposed to provide, while still avoiding > >>

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Nitin Gupta
On 01/24/2018 04:47 PM, Zi Yan wrote: With this change, whenever an application issues MADV_DONTNEED on a memory region, the region is marked as "space-efficient". For such regions, a hugepage is not immediately allocated on first write. >>> Kirill didn't like it in the previous

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Nitin Gupta
On 01/24/2018 04:47 PM, Zi Yan wrote: With this change, whenever an application issues MADV_DONTNEED on a memory region, the region is marked as "space-efficient". For such regions, a hugepage is not immediately allocated on first write. >>> Kirill didn't like it in the previous

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Michal Hocko
On Fri 19-01-18 12:59:17, Nitin Gupta wrote: > On 1/19/18 4:49 AM, Michal Hocko wrote: > > On Thu 18-01-18 15:33:16, Nitin Gupta wrote: > >> From: Nitin Gupta > >> > >> Currently, if the THP enabled policy is "always", or the mode > >> is "madvise" and a region is marked

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-25 Thread Michal Hocko
On Fri 19-01-18 12:59:17, Nitin Gupta wrote: > On 1/19/18 4:49 AM, Michal Hocko wrote: > > On Thu 18-01-18 15:33:16, Nitin Gupta wrote: > >> From: Nitin Gupta > >> > >> Currently, if the THP enabled policy is "always", or the mode > >> is "madvise" and a region is marked as MADV_HUGEPAGE, a

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-24 Thread Zi Yan
> >>> With this change, whenever an application issues MADV_DONTNEED on a >>> memory region, the region is marked as "space-efficient". For such >>> regions, a hugepage is not immediately allocated on first write. >> >> Kirill didn't like it in the previous version and I do not like this >>

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-24 Thread Zi Yan
> >>> With this change, whenever an application issues MADV_DONTNEED on a >>> memory region, the region is marked as "space-efficient". For such >>> regions, a hugepage is not immediately allocated on first write. >> >> Kirill didn't like it in the previous version and I do not like this >>

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-24 Thread Nitin Gupta
On 1/19/18 4:49 AM, Michal Hocko wrote: > On Thu 18-01-18 15:33:16, Nitin Gupta wrote: >> From: Nitin Gupta >> >> Currently, if the THP enabled policy is "always", or the mode >> is "madvise" and a region is marked as MADV_HUGEPAGE, a hugepage >> is allocated on a page

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-24 Thread Nitin Gupta
On 1/19/18 4:49 AM, Michal Hocko wrote: > On Thu 18-01-18 15:33:16, Nitin Gupta wrote: >> From: Nitin Gupta >> >> Currently, if the THP enabled policy is "always", or the mode >> is "madvise" and a region is marked as MADV_HUGEPAGE, a hugepage >> is allocated on a page fault if the pud or pmd is

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-19 Thread Michal Hocko
On Thu 18-01-18 15:33:16, Nitin Gupta wrote: > From: Nitin Gupta > > Currently, if the THP enabled policy is "always", or the mode > is "madvise" and a region is marked as MADV_HUGEPAGE, a hugepage > is allocated on a page fault if the pud or pmd is empty. This >

Re: [PATCH v2] mm: Reduce memory bloat with THP

2018-01-19 Thread Michal Hocko
On Thu 18-01-18 15:33:16, Nitin Gupta wrote: > From: Nitin Gupta > > Currently, if the THP enabled policy is "always", or the mode > is "madvise" and a region is marked as MADV_HUGEPAGE, a hugepage > is allocated on a page fault if the pud or pmd is empty. This > yields the best VA translation