Re: [PATCH 2/2] mm: thp: fix transparent_hugepage/defrag = madvise || always
From: Michal Hocko <mhocko@suse.com>
Date: 2018-08-28 08:18:40
[CC Stefan Priebe who has reported the same/similar issue on openSUSE mailing list recently - the thread starts http://lkml.kernel.org/r/20180820032204.9591-1-aarcange@redhat.com] On Tue 28-08-18 09:53:21, Michal Hocko wrote:
On Thu 23-08-18 12:52:53, Michal Hocko wrote:quoted
On Wed 22-08-18 11:52:50, Andrea Arcangeli wrote:quoted
On Wed, Aug 22, 2018 at 11:02:14AM +0200, Michal Hocko wrote:[...]quoted
quoted
I still have to digest the __GFP_THISNODE thing but I _think_ that the alloc_pages_vma code is just trying to be overly clever and __GFP_THISNODE is not a good fit for it.My option 2 did just that, it removed __GFP_THISNODE but only for MADV_HUGEPAGE and in general whenever reclaim was activated by __GFP_DIRECT_RECLAIM. That is also signal that the user really wants THP so then it's less bad to prefer THP over NUMA locality. For the default which is tuned for short lived allocation, preferring local memory is most certainly better win for short lived allocation where THP can't help much, this is why I didn't remove __GFP_THISNODE from the default defrag policy.Yes I agree.I finally got back to this again. I have checked your patch and I am really wondering whether alloc_pages_vma is really the proper place to play these tricks. We already have that mind blowing alloc_hugepage_direct_gfpmask and it should be the proper place to handle this special casing. So what do you think about the following. It should be essentially the same thing. Aka use __GFP_THIS_NODE only when we are doing an optimistic THP allocation. Madvise signalizes you know what you are doing and THP has the top priority. If you care enough about the numa placement then you should better use mempolicy.
Now the patch is still untested but it compiles at least. ---