All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>,
	"George Dunlap" <george.dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Julien Grall" <julien.grall@arm.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v3 01/10] page-alloc: Clamp get_free_buddy() to online nodes
Date: Mon, 29 Jul 2019 13:11:55 +0100	[thread overview]
Message-ID: <20190729121204.13559-2-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20190729121204.13559-1-andrew.cooper3@citrix.com>

d->node_affinity defaults to NODE_MASK_ALL which has bits set outside of
node_online_map.  This in turn causes the loop in get_free_buddy() to waste
effort iterating over offline nodes.

Always clamp d->node_affinity to node_online_map when in use.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>

v3:
 * Rebase to before the nodemask API cleanup, to make it easier to backport.
v2:
 * Rebase over the nodemask API change, and implement with a single
   nodes_and()
---
 xen/common/page_alloc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 44a72d0b19..efa437c7df 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -811,11 +811,18 @@ static struct page_info *get_free_buddy(unsigned int zone_lo,
                                         const struct domain *d)
 {
     nodeid_t first, node = MEMF_get_node(memflags), req_node = node;
-    nodemask_t nodemask = d ? d->node_affinity : node_online_map;
+    nodemask_t nodemask = node_online_map;
     unsigned int j, zone, nodemask_retry = 0;
     struct page_info *pg;
     bool use_unscrubbed = (memflags & MEMF_no_scrub);
 
+    /*
+     * d->node_affinity is our preferred allocation set if provided, but it
+     * may have bit set outside of node_online_map.  Clamp it.
+     */
+    if ( d )
+        nodes_and(nodemask, nodemask, d->node_affinity);
+
     if ( node == NUMA_NO_NODE )
     {
         if ( d != NULL )
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-07-29 12:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 12:11 [Xen-devel] [PATCH v3 00/10] xen/nodemask: API cleanup and fixes Andrew Cooper
2019-07-29 12:11 ` Andrew Cooper [this message]
2019-07-29 15:48   ` [Xen-devel] [PATCH v3 01/10] page-alloc: Clamp get_free_buddy() to online nodes Jan Beulich
2019-07-29 17:26     ` Andrew Cooper
2019-07-30  8:09       ` Jan Beulich
2019-07-30 17:32         ` Andrew Cooper
2019-07-31  8:22           ` Jan Beulich
2019-07-31  9:01             ` Andrew Cooper
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 02/10] xen/bitmap: Drop {bitmap, cpumask, nodes}_shift_{left, right}() Andrew Cooper
2019-07-29 15:50   ` Jan Beulich
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 03/10] xen/nodemask: Drop any_online_node() and first_unset_node() Andrew Cooper
2019-07-29 15:51   ` Jan Beulich
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 04/10] xen/mask: Convert {cpu, node}mask_test() to be static inline Andrew Cooper
2019-07-30  8:52   ` Jan Beulich
2019-07-30  9:03     ` Andrew Cooper
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 05/10] xen/cpumask: Introduce a CPUMASK_PR() wrapper for printing Andrew Cooper
2019-07-30  8:55   ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 06/10] xen/nodemask: Introduce a NODEMASK_PR() " Andrew Cooper
2019-07-30  8:58   ` Jan Beulich
2019-07-30  9:09     ` Andrew Cooper
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 07/10] xen/nodemask: Drop nodes_{setall, clear}() and improve the initialisers Andrew Cooper
2019-07-30  9:44   ` Jan Beulich
2019-07-31 12:49     ` Andrew Cooper
2019-07-31 13:12       ` Jan Beulich
2019-07-31 13:32         ` Andrew Cooper
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 08/10] xen/nodemask: Introduce unlocked __nodemask_{set, clear}() helpers Andrew Cooper
2019-07-30 11:26   ` Jan Beulich
2019-07-30 17:48     ` Andrew Cooper
2019-07-31  8:41       ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 09/10] xen/nodemask: Sanitise the remainder of the nodemask API Andrew Cooper
2019-07-30 11:43   ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 10/10] xen/nodemask: Drop remaining refeces to linux Andrew Cooper
2019-07-30 11:44   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190729121204.13559-2-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.