linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Linux-X86 <x86@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Mel Gorman <mgorman@suse.de>, Peter Anvin <hpa@zytor.com>,
	Ingo Molnar <mingo@kernel.org>,
	Steven Noonan <steven@uplinklabs.net>,
	Rik van Riel <riel@redhat.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 5/5] x86: Allow Xen to enable NUMA_BALANCING
Date: Tue,  8 Apr 2014 14:09:30 +0100	[thread overview]
Message-ID: <1396962570-18762-6-git-send-email-mgorman@suse.de> (raw)
In-Reply-To: <1396962570-18762-1-git-send-email-mgorman@suse.de>

Xen cannot use automatic NUMA balancing as they are depending on the same PTE
bit. There is another software bit that is currently used by software dirty
tracking of pages. This patch allows Xen to use that bit for automatic NUMA
balancing if MEM_SOFT_DIRTY is not enabled. If KMEMCHECK is enabled then
the bit is only set on global page tables so there should be no collision
with NUMA_BALANCING. This shuffling can be disabled if/when Xen moves away
from using _PAGE_BIT_IOMAP.

Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 arch/x86/Kconfig                     |  2 +-
 arch/x86/include/asm/pgtable_types.h | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 4fab25a..3c4ba81 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -26,7 +26,7 @@ config X86
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_AOUT if X86_32
 	select HAVE_UNSTABLE_SCHED_CLOCK
-	select ARCH_SUPPORTS_NUMA_BALANCING if X86_64 && !XEN
+	select ARCH_SUPPORTS_NUMA_BALANCING if X86_64 && (!XEN || !MEM_SOFT_DIRTY)
 	select ARCH_SUPPORTS_INT128 if X86_64
 	select ARCH_WANTS_PROT_NUMA_PROT_NONE
 	select HAVE_IDE
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 49b3e15..fa84d1f 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -24,11 +24,23 @@
 #define _PAGE_BIT_CPA_TEST	_PAGE_BIT_SOFTW1
 #define _PAGE_BIT_SPLITTING	_PAGE_BIT_SOFTW1 /* only valid on a PSE pmd */
 #define _PAGE_BIT_IOMAP		_PAGE_BIT_SOFTW2 /* flag used to indicate IO mapping */
-#define _PAGE_BIT_NUMA		_PAGE_BIT_SOFTW2 /* for NUMA balancing hinting */
 #define _PAGE_BIT_HIDDEN	_PAGE_BIT_SOFTW3 /* hidden by kmemcheck */
 #define _PAGE_BIT_SOFT_DIRTY	_PAGE_BIT_SOFTW3 /* software dirty tracking */
 #define _PAGE_BIT_NX           63       /* No execute: only valid after cpuid check */
 
+/*
+ * Automatic NUMA balancing uses _PAGE_BIT_SOFTW2 if available as generally it
+ * is only used on the kernel page tables and is easily shared. Unfortunately,
+ * Xen also uses this bit so on those configurations it is necessary to use
+ * _PAGE_BIT_SOFTW3 but then MEM_SOFT_DIRTY cannot be enabled at the same time
+ * as it also requires that bit. Constraint is enforced by Kconfig.
+ */
+#ifndef CONFIG_XEN
+#define _PAGE_BIT_NUMA		_PAGE_BIT_SOFTW2
+#else
+#define _PAGE_BIT_NUMA		_PAGE_BIT_SOFTW3
+#endif
+
 /* If _PAGE_BIT_PRESENT is clear, we use these: */
 /* - if the user mapped it with PROT_NONE; pte_present gives true */
 #define _PAGE_BIT_PROTNONE	_PAGE_BIT_GLOBAL
-- 
1.8.4.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-04-08 13:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 13:09 [RFC PATCH 0/5] Use an alternative to _PAGE_PROTNONE for _PAGE_NUMA v2 Mel Gorman
2014-04-08 13:09 ` [PATCH 1/5] x86: Require x86-64 for automatic NUMA balancing Mel Gorman
2014-04-08 13:09 ` [PATCH 2/5] x86: Define _PAGE_NUMA by reusing software bits on the PMD and PTE levels Mel Gorman
2014-04-08 13:09 ` [PATCH 3/5] mm: Allow FOLL_NUMA on FOLL_FORCE Mel Gorman
2014-04-08 13:09 ` [PATCH 4/5] mm: use paravirt friendly ops for NUMA hinting ptes Mel Gorman
2014-04-08 17:21   ` David Vrabel
2014-04-15 10:27   ` David Vrabel
2014-04-15 14:44     ` Mel Gorman
2014-04-08 13:09 ` Mel Gorman [this message]
2014-04-08 14:40 ` [RFC PATCH 0/5] Use an alternative to _PAGE_PROTNONE for _PAGE_NUMA v2 H. Peter Anvin
2014-04-08 15:22   ` Linus Torvalds
2014-04-08 16:04     ` H. Peter Anvin
2014-04-08 16:12     ` Peter Zijlstra
2014-04-08 16:46     ` Mel Gorman
2014-04-08 17:01       ` Linus Torvalds
2014-04-08 18:51         ` Mel Gorman
2014-04-08 18:55           ` Linus Torvalds
2014-04-08 19:06             ` Mel Gorman
2014-04-08 19:08             ` Rik van Riel
2014-04-08 17:03       ` Mel Gorman
2014-04-08 17:30       ` Peter Zijlstra
2014-04-08 17:41         ` Linus Torvalds
2014-04-08 18:16         ` Cyrill Gorcunov
2014-04-09  6:21         ` Ingo Molnar
2014-04-09 23:34           ` H. Peter Anvin
2014-04-10  0:12             ` Linus Torvalds

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=1396962570-18762-6-git-send-email-mgorman@suse.de \
    --to=mgorman@suse.de \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=david.vrabel@citrix.com \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=steven@uplinklabs.net \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox