Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1168248

Re: [PATCH] mm, thp: respect MPOL_PREFERRED policy with non-local node

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm, thp: respect MPOL_PREFERRED policy with non-local node
Date Thu, 18 Jun 2015 21:40:02 +0200
Message-ID <pCNPk-1bG-3@gated-at.bofh.it> (permalink)
References <pCJsn-3cl-33@gated-at.bofh.it>
X-Original-To Vlastimil Babka <vbabka@suse.cz>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version:content-type; bh=U6xA0Q9VkcHY/LX+wfiMYYdOt5mKYi7I9/pfj+8I778=; b=LYW/WJhoMFOrOeu7Whribf0N83tx1OyqqpJQUb6uihfFiXZdfapFJNw1o0URgIJO4u 9AnZ+bu9U4E+vWthhBRbN0xlRtNiSE37fzKQDDM0OZUO6AIbg6986pKSWrir+PntiC9H gTymoRc95qtqGchyngI7k5Ns5h8UFf4PW7L4HrBVZmlDViAGifMzNU2tsQhz9uhTKLLl aOrPBkR8sZ4kcvOrPu5IoekzutolMd8nIGjxgODpdtfK5DKCYzXh42p0vDh7mv123CNP v1NooPG3oTHyQVM2Z74iImWck56hiHJqv/5F+I2T1LGgH7d6FFOUkiQsQzVntLmh0jy6 i5sg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=U6xA0Q9VkcHY/LX+wfiMYYdOt5mKYi7I9/pfj+8I778=; b=BSY3M+A+iq0Qom6i9CYq0OaoXlwtEuRashV/pGCCo4VBnONS5cmATp7Nt+Bjlws9wv yfYYomj6+G2Rxpi0TE4oXISi91r3KuxiTURIWP2wmD5oMh4Fwm9UBZ/p/tPCglsPYCPV RSbDknmXjJlIkPdW07sN1V10WkZHXTJwVn1fv7mNdBJNhT7ULo7fNISjWKSE0crWYglq qv3xGSx41lp0I0uMBzM7lltYqZqhPiyN1jCKyTDmPi6HLpPmgSMEZaaE2RXDOuQSNNNl bKE1l4G16pDjjnGfc5tHviiRPuTubS/PwGKcS4hn1J/dol9YMyXkr4tyRR8FkoybASib LUAQ==
X-Gm-Message-State ALoCoQlONOIyBLnk6Ss+VYuhwT9Miqp/ylDtvjxUzrZ1/2qWh/2CrMwUzPLW+y1SlewoMGCqOJBP
X-Received by 10.50.109.138 with SMTP id hs10mr20338293igb.48.1434655974380; Thu, 18 Jun 2015 12:32:54 -0700 (PDT)
X-X-Sender rientjes@chino.kir.corp.google.com
User-Agent Alpine 2.10 (DEB 1266 2009-07-14)
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 88
Organization linux.* mail to news gateway
X-Original-Cc Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Andrea Arcangeli <aarcange@redhat.com>, Michal Hocko <mhocko@suse.cz>
X-Original-Date Thu, 18 Jun 2015 12:32:52 -0700 (PDT)
X-Original-Message-ID <alpine.DEB.2.10.1506181231011.3668@chino.kir.corp.google.com>
X-Original-References <1434639273-9527-1-git-send-email-vbabka@suse.cz>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1168248

Show key headers only | View raw


On Thu, 18 Jun 2015, Vlastimil Babka wrote:

> Since commit 077fcf116c8c ("mm/thp: allocate transparent hugepages on local
> node"), we handle THP allocations on page fault in a special way - for
> non-interleave memory policies, the allocation is only attempted on the node
> local to the current CPU, if the policy's nodemask allows the node.
> 
> This is motivated by the assumption that THP benefits cannot offset the cost
> of remote accesses, so it's better to fallback to base pages on the local node
> (which might still be available, while huge pages are not due to
> fragmentation) than to allocate huge pages on a remote node.
> 
> The nodemask check prevents us from violating e.g. MPOL_BIND policies where
> the local node is not among the allowed nodes. However, the current
> implementation can still give surprising results for the MPOL_PREFERRED policy
> when the preferred node is different than the current CPU's local node.
> 
> In such case we should honor the preferred node and not use the local node,
> which is what this patch does. If hugepage allocation on the preferred node
> fails, we fall back to base pages and don't try other nodes, with the same
> motivation as is done for the local node hugepage allocations.
> The patch also moves the MPOL_INTERLEAVE check around to simplify the hugepage
> specific test.
> 
> The difference can be demonstrated using in-tree transhuge-stress test on the
> following 2-node machine where half memory on one node was occupied to show
> the difference.
> 
> > numactl --hardware
> available: 2 nodes (0-1)
> node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 24 25 26 27 28 29 30 31 32 33 34 35
> node 0 size: 7878 MB
> node 0 free: 3623 MB
> node 1 cpus: 12 13 14 15 16 17 18 19 20 21 22 23 36 37 38 39 40 41 42 43 44 45 46 47
> node 1 size: 8045 MB
> node 1 free: 7818 MB
> node distances:
> node   0   1
>   0:  10  21
>   1:  21  10
> 
> Before the patch:
> > numactl -p0 -C0 ./transhuge-stress
> transhuge-stress: 2.197 s/loop, 0.276 ms/page,   7249.168 MiB/s 7962 succeed,    0 failed, 1786 different pages
> 
> > numactl -p0 -C12 ./transhuge-stress
> transhuge-stress: 2.962 s/loop, 0.372 ms/page,   5376.172 MiB/s 7962 succeed,    0 failed, 3873 different pages
> 
> Number of successful THP allocations corresponds to free memory on node 0 in
> the first case and node 1 in the second case, i.e. -p parameter is ignored and
> cpu binding "wins".
> 
> After the patch:
> > numactl -p0 -C0 ./transhuge-stress
> transhuge-stress: 2.183 s/loop, 0.274 ms/page,   7295.516 MiB/s 7962 succeed,    0 failed, 1760 different pages
> 
> > numactl -p0 -C12 ./transhuge-stress
> transhuge-stress: 2.878 s/loop, 0.361 ms/page,   5533.638 MiB/s 7962 succeed,    0 failed, 1750 different pages
> 
> > numactl -p1 -C0 ./transhuge-stress
> transhuge-stress: 4.628 s/loop, 0.581 ms/page,   3440.893 MiB/s 7962 succeed,    0 failed, 3918 different pages
> 
> The -p parameter is respected regardless of cpu binding.
> 
> > numactl -C0 ./transhuge-stress
> transhuge-stress: 2.202 s/loop, 0.277 ms/page,   7230.003 MiB/s 7962 succeed,    0 failed, 1750 different pages
> 
> > numactl -C12 ./transhuge-stress
> transhuge-stress: 3.020 s/loop, 0.379 ms/page,   5273.324 MiB/s 7962 succeed,    0 failed, 3916 different pages
> 
> Without -p parameter, hugepage restriction to CPU-local node works as before.
> 
> Fixes: 077fcf116c8c ("mm/thp: allocate transparent hugepages on local node")
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Michal Hocko <mhocko@suse.cz>

Acked-by: David Rientjes <rientjes@google.com>

Good catch!  I think this is deserving of stable@vger.kernel.org # 4.0+
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] mm, thp: respect MPOL_PREFERRED policy with non-local  node David Rientjes <rientjes@google.com> - 2015-06-18 21:40 +0200

csiph-web