Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1229920
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/11] x86/mm/pat/32: Remove pgd_list use from the PAT code |
| Date | 2015-09-22 08:30 +0200 |
| Message-ID | <qbpfr-5Ff-17@gated-at.bofh.it> (permalink) |
| References | <qbpfr-5Ff-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The 32-bit x86 PAT code uses __set_pmd_pte() to update pmds.
This uses pgd_list currently, but we don't need the global
list as we can walk the task list under RCU.
(This code already holds the pgd_lock.)
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <Waiman.Long@hp.com>
Cc: linux-mm@kvack.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/mm/pageattr.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index b784ed7c9a7e..bc7533801014 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -12,6 +12,7 @@
#include <linux/pfn.h>
#include <linux/percpu.h>
#include <linux/gfp.h>
+#include <linux/oom.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
@@ -438,18 +439,36 @@ static void __set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte)
set_pte_atomic(kpte, pte);
#ifdef CONFIG_X86_32
if (!SHARED_KERNEL_PMD) {
- struct page *page;
+ struct task_struct *g;
- list_for_each_entry(page, &pgd_list, lru) {
+ rcu_read_lock(); /* Task list walk */
+
+ for_each_process(g) {
+ struct task_struct *p;
+ struct mm_struct *mm;
+ spinlock_t *pgt_lock;
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
- pgd = (pgd_t *)page_address(page) + pgd_index(address);
+ p = find_lock_task_mm(g);
+ if (!p)
+ continue;
+
+ mm = p->mm;
+ pgt_lock = &mm->page_table_lock;
+ spin_lock(pgt_lock);
+
+ pgd = mm->pgd + pgd_index(address);
pud = pud_offset(pgd, address);
pmd = pmd_offset(pud, address);
set_pte_atomic((pte_t *)pmd, pte);
+
+ spin_unlock(pgt_lock);
+
+ task_unlock(p);
}
+ rcu_read_unlock();
}
#endif
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/11] x86/mm: Implement lockless pgd_alloc()/pgd_free() Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
[PATCH 07/11] x86/mm: Remove pgd_list use from vmalloc_sync_all() Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
Re: [PATCH 07/11] x86/mm: Remove pgd_list use from vmalloc_sync_all() Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-22 20:00 +0200
[PATCH 06/11] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
Re: [PATCH 06/11] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-22 20:00 +0200
Re: [PATCH 06/11] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code Ingo Molnar <mingo@kernel.org> - 2015-09-29 10:50 +0200
[PATCH 10/11] x86/mm: Remove pgd_list leftovers Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
[PATCH 08/11] x86/mm/pat/32: Remove pgd_list use from the PAT code Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
[PATCH 09/11] x86/mm: Make pgd_alloc()/pgd_free() lockless Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
[PATCH 02/11] x86/mm/hotplug: Remove pgd_list use from the memory hotplug code Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
Re: [PATCH 02/11] x86/mm/hotplug: Remove pgd_list use from the memory hotplug code Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-22 19:50 +0200
Re: [PATCH 02/11] x86/mm/hotplug: Remove pgd_list use from the memory hotplug code Oleg Nesterov <oleg@redhat.com> - 2015-09-23 13:50 +0200
Re: [PATCH 02/11] x86/mm/hotplug: Remove pgd_list use from the memory hotplug code Ingo Molnar <mingo@kernel.org> - 2015-09-29 10:50 +0200
Re: [PATCH 02/11] x86/mm/hotplug: Remove pgd_list use from the memory hotplug code Oleg Nesterov <oleg@redhat.com> - 2015-09-29 19:00 +0200
[PATCH 03/11] x86/mm/hotplug: Don't remove PGD entries in remove_pagetable() Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
[PATCH 01/11] x86/mm/pat: Don't free PGD entries on memory unmap Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
Re: [PATCH 01/11] x86/mm/pat: Don't free PGD entries on memory unmap Linus Torvalds <torvalds@linux-foundation.org> - 2015-09-22 19:50 +0200
Re: [PATCH 01/11] x86/mm/pat: Don't free PGD entries on memory unmap Andy Lutomirski <luto@amacapital.net> - 2015-09-22 20:10 +0200
[PATCH 04/11] x86/mm/hotplug: Simplify sync_global_pgds() Ingo Molnar <mingo@kernel.org> - 2015-09-22 08:30 +0200
csiph-web