Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1499670
| Path | csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Michal Hocko <mhocko@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | Re: MPOL_BIND on memory only nodes |
| Date | Wed, 12 Oct 2016 15:20:02 +0200 |
| Message-ID | <srrBU-4SP-39@gated-at.bofh.it> (permalink) |
| References | <sro1j-2kL-9@gated-at.bofh.it> <srokF-2sg-13@gated-at.bofh.it> |
| X-Original-To | Mel Gorman <mgorman@suse.de> |
| 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YpLpgOsrk478nteRl2+aLABu3CzBWohMPhWTBtOOi6w=; b=JlypfUj7shwa7RTb2TQfYIDzZWT5mONVkJnEVmCUzz+Rdjrl9L+r5YjnSuxuwo6zxD HcU2Wff0J2Gq/nlR4QXyu7mD2ftESPqA+r84jzMKXHI4qXrAUnvkDmGWPF+IdU+EYATj /SM1ULznSt3RHgoGb4385WYj/mw3DWCT2GV1gHjeh1LIIwaF1f8Wz96/yf/KhdF/cLdU pVEeHtBfHd8flOyF5N/obQ0zmkoheRkEyE+Ldikt8ejhRo+WLoG4l3CBGcPi235kK80U P8BYMTgcCGtuKR7dWsCwht99tKQCcBmXhfFrIwG7IgvJNfOS7TCmLpybS3oMlLSeT2pY ucPQ== |
| X-Gm-Message-State | AA6/9RldI95xFtYx2RlDXXAVhrZ7YJHoKTNNQfdY4DqpuEIIFhzhXNKwAN+d+2/Donyg3Q== |
| X-Received | by 10.194.205.228 with SMTP id lj4mr1395111wjc.123.1476278188865; Wed, 12 Oct 2016 06:16:28 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.6.0 (2016-04-01) |
| 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 | 67 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Linux Memory Management List <linux-mm@kvack.org>, Andrew Morton <akpm@linux-foundation.org>, Anshuman Khandual <khandual@linux.vnet.ibm.com>, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>, Balbir Singh <bsingharora@gmail.com>, Vlastimil Babka <vbabka@suse.cz>, Minchan Kim <minchan@kernel.org> |
| X-Original-Date | Wed, 12 Oct 2016 15:16:27 +0200 |
| X-Original-Message-ID | <20161012131626.GL17128@dhcp22.suse.cz> |
| X-Original-References | <57FE0184.6030008@linux.vnet.ibm.com> <20161012094337.GH17128@dhcp22.suse.cz> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1499670 |
Show key headers only | View raw
On Wed 12-10-16 11:43:37, Michal Hocko wrote:
> On Wed 12-10-16 14:55:24, Anshuman Khandual wrote:
[...]
> > Why we insist on __GFP_THISNODE ?
>
> AFAIU __GFP_THISNODE just overrides the given node to the policy
> nodemask in case the current node is not part of that node mask. In
> other words we are ignoring the given node and use what the policy says.
> I can see how this can be confusing especially when confronting the
> documentation:
>
> * __GFP_THISNODE forces the allocation to be satisified from the requested
> * node with no fallbacks or placement policy enforcements.
You made me think and look into this deeper. I came to the conclusion
that this is actually a relict from the past. policy_zonelist is called
only from 3 places:
- huge_zonelist - never should do __GFP_THISNODE when going this path
- alloc_pages_vma - which shouldn't depend on __GFP_THISNODE either
- alloc_pages_current - which uses default_policy id __GFP_THISNODE is
used
So AFAICS this is essentially a dead code or I am missing something. Mel
do you remember why we needed it in the past? I would be really tempted
to just get rid of this confusing code and this instead:
---
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ad1c96ac313c..98beec47bba9 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1679,25 +1679,17 @@ static nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy)
static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
int nd)
{
- switch (policy->mode) {
- case MPOL_PREFERRED:
- if (!(policy->flags & MPOL_F_LOCAL))
- nd = policy->v.preferred_node;
- break;
- case MPOL_BIND:
+ if (policy->mode == MPOL_PREFERRED && !(policy->flags & MPOL_F_LOCAL))
+ nd = policy->v.preferred_node;
+ else {
/*
- * Normally, MPOL_BIND allocations are node-local within the
- * allowed nodemask. However, if __GFP_THISNODE is set and the
- * current node isn't part of the mask, we use the zonelist for
- * the first node in the mask instead.
+ * __GFP_THISNODE shouldn't even be used with the bind policy because
+ * we might easily break the expectation to stay on the requested node
+ * and not break the policy.
*/
- if (unlikely(gfp & __GFP_THISNODE) &&
- unlikely(!node_isset(nd, policy->v.nodes)))
- nd = first_node(policy->v.nodes);
- break;
- default:
- BUG();
+ WARN_ON_ONCE(polic->mode == MPOL_BIND && (gfp && __GFP_THISNODE));
}
+
return node_zonelist(nd, gfp);
}
--
Michal Hocko
SUSE Labs
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
MPOL_BIND on memory only nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-10-12 11:30 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-12 11:50 +0200
Re: MPOL_BIND on memory only nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-10-12 12:40 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-12 13:10 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-12 15:20 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-13 12:20 +0200
Re: MPOL_BIND on memory only nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-10-13 14:30 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-13 15:00 +0200
Re: MPOL_BIND on memory only nodes Mel Gorman <mgorman@suse.de> - 2016-10-13 12:50 +0200
Re: MPOL_BIND on memory only nodes Michal Hocko <mhocko@kernel.org> - 2016-10-13 14:40 +0200
Re: MPOL_BIND on memory only nodes Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-10-13 14:50 +0200
csiph-web