summaryrefslogtreecommitdiff
path: root/mm/memory.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2009-07-03 13:44:54 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-10 00:19:00 (GMT)
commit5e026c64d3221cef95ca9353f8f5f6c1b8fca2eb (patch)
treeed754fd4815223fe7909e3afdaca825d07c699c4 /mm/memory.c
parentd7872e48930012df3b50971d7ab34716bf5cd236 (diff)
downloadlinux-fsl-qoriq-5e026c64d3221cef95ca9353f8f5f6c1b8fca2eb.tar.xz
mm: shrink the page frame to !-rt size
He below is a boot-tested hack to shrink the page frame size back to normal. Should be a net win since there should be many less PTE-pages than page-frames. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c
index f342221..5771e09 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4342,3 +4342,35 @@ void copy_user_huge_page(struct page *dst, struct page *src,
}
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
+
+#if defined(CONFIG_PREEMPT_RT_FULL) && (USE_SPLIT_PTLOCKS > 0)
+/*
+ * Heinous hack, relies on the caller doing something like:
+ *
+ * pte = alloc_pages(PGALLOC_GFP, 0);
+ * if (pte)
+ * pgtable_page_ctor(pte);
+ * return pte;
+ *
+ * This ensures we release the page and return NULL when the
+ * lock allocation fails.
+ */
+struct page *pte_lock_init(struct page *page)
+{
+ page->ptl = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
+ if (page->ptl) {
+ spin_lock_init(__pte_lockptr(page));
+ } else {
+ __free_page(page);
+ page = NULL;
+ }
+ return page;
+}
+
+void pte_lock_deinit(struct page *page)
+{
+ kfree(page->ptl);
+ page->mapping = NULL;
+}
+
+#endif