[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1345647560-30387-9-git-send-email-aarcange@redhat.com>
Date: Wed, 22 Aug 2012 16:58:52 +0200
From: Andrea Arcangeli <aarcange@...hat.com>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: Hillf Danton <dhillf@...il.com>, Dan Smith <danms@...ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...e.hu>, Paul Turner <pjt@...gle.com>,
Suresh Siddha <suresh.b.siddha@...el.com>,
Mike Galbraith <efault@....de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Lai Jiangshan <laijs@...fujitsu.com>,
Bharata B Rao <bharata.rao@...il.com>,
Lee Schermerhorn <Lee.Schermerhorn@...com>,
Rik van Riel <riel@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>,
Christoph Lameter <cl@...ux.com>,
Alex Shi <alex.shi@...el.com>,
Mauricio Faria de Oliveira <mauricfo@...ux.vnet.ibm.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Don Morris <don.morris@...com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: [PATCH 08/36] autonuma: define the autonuma flags
These flags are the ones tweaked through sysfs, they control the
behavior of autonuma, from enabling disabling it, to selecting various
runtime options.
Signed-off-by: Andrea Arcangeli <aarcange@...hat.com>
---
include/linux/autonuma_flags.h | 129 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 129 insertions(+), 0 deletions(-)
create mode 100644 include/linux/autonuma_flags.h
diff --git a/include/linux/autonuma_flags.h b/include/linux/autonuma_flags.h
new file mode 100644
index 0000000..f53203a
--- /dev/null
+++ b/include/linux/autonuma_flags.h
@@ -0,0 +1,129 @@
+#ifndef _LINUX_AUTONUMA_FLAGS_H
+#define _LINUX_AUTONUMA_FLAGS_H
+
+/*
+ * If CONFIG_AUTONUMA=n this file isn't included and only
+ * autonuma_possible() is defined (as false) in autonuma.h to allow
+ * optimizing away at compile time blocks of common code without using
+ * #ifdefs.
+ */
+#ifndef CONFIG_AUTONUMA
+#error "autonuma flags included by mistake"
+#endif
+
+enum autonuma_flag {
+ /*
+ * Set if the kernel wasn't passed the "noautonuma" boot
+ * parameter and the hardware is NUMA. If AutoNUMA is not
+ * possible the value of all other flags becomes irrelevant
+ * (they will never be checked) and AutoNUMA can't be enabled.
+ *
+ * No defaults: depends on hardware discovery and "noautonuma"
+ * early param.
+ */
+ AUTONUMA_POSSIBLE_FLAG,
+ /*
+ * If AutoNUMA is possible, this defines if AutoNUMA is
+ * currently enabled or disabled. It can be toggled at runtime
+ * through sysfs.
+ *
+ * The default depends on CONFIG_AUTONUMA_DEFAULT_ENABLED.
+ */
+ AUTONUMA_ENABLED_FLAG,
+ /*
+ * If set through sysfs this will print lots of debug info
+ * about the AutoNUMA activities in the kernel logs.
+ *
+ * Default not set.
+ */
+ AUTONUMA_DEBUG_FLAG,
+ /*
+ * This defines if CFS should prioritize between load
+ * balancing fairness or NUMA affinity, if there are no idle
+ * CPUs available. If this flag is set AutoNUMA will
+ * prioritize on NUMA affinity and it will disregard
+ * inter-node fairness.
+ *
+ * Default not set.
+ */
+ AUTONUMA_SCHED_LOAD_BALANCE_STRICT_FLAG,
+ /*
+ * This flag defines if the task/mm_autonuma statistics should
+ * be inherithed from the parent task/process or instead if
+ * they should be cleared at every fork/clone. The
+ * task/mm_autonuma statistics are always cleared across
+ * execve and there's no way to disable that.
+ *
+ * Default set.
+ */
+ AUTONUMA_SCHED_RESET_FLAG,
+ /*
+ * If set, this tells knuma_scand to trigger NUMA hinting page
+ * faults at the pmd level instead of the pte level. This
+ * reduces the number of NUMA hinting faults potentially
+ * saving CPU time. It reduces the accuracy of the
+ * task_autonuma statistics (but does not change the accuracy
+ * of the mm_autonuma statistics). This flag can be toggled
+ * through sysfs as runtime.
+ *
+ * This flag does not affect AutoNUMA with transparent
+ * hugepages (THP). With THP the NUMA hinting page faults
+ * always happen at the pmd level, regardless of the setting
+ * of this flag. Note: there is no reduction in accuracy of
+ * task_autonuma statistics with THP.
+ *
+ * Default set.
+ */
+ AUTONUMA_SCAN_PMD_FLAG,
+ /*
+ * If set, knuma_migrated will wake up in the middle of each
+ * knuma_scand pass, regardless of how many pages have been
+ * already queued. If not set knuma_migrated will wake up as
+ * soon as the number of pages in the migration LRU reached a
+ * certain threshold.
+ *
+ * Default not set.
+ */
+ AUTONUMA_MIGRATE_DEFER_FLAG,
+};
+
+extern unsigned long autonuma_flags;
+
+static inline bool autonuma_possible(void)
+{
+ return test_bit(AUTONUMA_POSSIBLE_FLAG, &autonuma_flags);
+}
+
+static inline bool autonuma_enabled(void)
+{
+ return test_bit(AUTONUMA_ENABLED_FLAG, &autonuma_flags);
+}
+
+static inline bool autonuma_debug(void)
+{
+ return test_bit(AUTONUMA_DEBUG_FLAG, &autonuma_flags);
+}
+
+static inline bool autonuma_sched_load_balance_strict(void)
+{
+ return test_bit(AUTONUMA_SCHED_LOAD_BALANCE_STRICT_FLAG,
+ &autonuma_flags);
+}
+
+static inline bool autonuma_sched_reset(void)
+{
+ return test_bit(AUTONUMA_SCHED_RESET_FLAG,
+ &autonuma_flags);
+}
+
+static inline bool autonuma_scan_pmd(void)
+{
+ return test_bit(AUTONUMA_SCAN_PMD_FLAG, &autonuma_flags);
+}
+
+static inline bool autonuma_migrate_defer(void)
+{
+ return test_bit(AUTONUMA_MIGRATE_DEFER_FLAG, &autonuma_flags);
+}
+
+#endif /* _LINUX_AUTONUMA_FLAGS_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists