Nocow patch.
Subsystems (7)
Hi,
after testing on ARM, here is the latest version of the nocow patch, split in three parts, the noarch part, the x86 specific patch and the arm specific patch.
Signature · 1 line
Gilles Chanteperdrix
include/linux/ipipe.h +13 -2
@@ -337,6 +337,15 @@ int fastcall __ipipe_dispatch_wired(stru void fastcall __ipipe_sync_stage(unsigned long syncmask); +int __ipipe_update_all_pinned_mm (unsigned long start,unsigned long end); + +struct mm_struct ; + +void __ipipe_unlink_pinned_mm (struct mm_struct *mm); + +int __ipipe_pin_range_mapping (struct mm_struct *mm, +unsigned long start,unsigned long end); +#ifndef __ipipe_sync_pipeline#define __ipipe_sync_pipeline (syncmask) __ipipe_sync_stage(syncmask)#endif
@@ -434,12 +443,11 @@ static inline void ipipe_init_notify(str__ipipe_dispatch_event (IPIPE_EVENT_INIT ,p); } -struct mm_struct ; -static inline void ipipe_cleanup_notify (struct mm_struct *mm) {if (__ipipe_event_monitored_p (IPIPE_EVENT_CLEANUP ))__ipipe_dispatch_event (IPIPE_EVENT_CLEANUP ,mm); +__ipipe_unlink_pinned_mm (mm); }/* Public interface */
@@ -643,6 +651,8 @@ int fastcall ipipe_set_ptd(int key, void fastcall *ipipe_get_ptd(int key); +int ipipe_disable_ondemand_mappings (struct task_struct *tsk); +#define local_irq_enable_hw_cond () local_irq_enable_hw()#define local_irq_disable_hw_cond () local_irq_disable_hw()#define local_irq_save_hw_cond (flags) local_irq_save_hw(flags)
@@ -690,6 +700,7 @@ void fastcall *ipipe_get_ptd(int key);#define ipipe_cleanup_notify (mm) do { } while(0)#define ipipe_trap_notify (t,r) 0#define ipipe_init_proc () do { } while(0) +#define __ipipe_update_all_pinned_mm (start, end) 0#define local_irq_enable_hw_cond () do { } while(0)#define local_irq_disable_hw_cond () do { } while(0)
include/linux/mm.h +1 -0
@@ -166,6 +166,7 @@ extern unsigned int kobjsize(const void#define VM_NONLINEAR 0x00800000/* Is non-linear (remap_file_pages) */ #define VM_MAPPED_COPY 0x01000000/* T if mapped copy of data (nommu mmap) */ #define VM_INSERTPAGE 0x02000000/* The vma has had "vm_insert_page()" done on it */ +#define VM_PINNED 0x10000000/* Disable faults for the vma */ #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
include/linux/sched.h +4 -0
@@ -363,6 +363,10 @@ struct mm_struct {/* aio bits */ rwlock_t ioctx_list_lock;struct kioctx *ioctx_list; + +#if CONFIG_IPIPE +struct list_head pinned; +#endif /* CONFIG_IPIPE */ };struct sighand_struct {
lib/ioremap.c +2 -3
@@ -85,10 +85,9 @@ int ioremap_page_range(unsigned long add err =ioremap_pud_range (pgd, addr, next, phys_addr+addr, prot);if (err)break ; -set_pgdir (addr, *pgd); }while (pgd++, addr = next, addr != end); - -flush_cache_vmap (start, end); +__ipipe_update_all_pinned_mm (start, end); +flush_cache_vmap (start, end);return err; }
mm/memory.c +207 -30
282 lines not on this page · raw message
mm/mlock.c +1 -1
@@ -166,7 +166,7 @@ static int do_mlockall(int flags)if (flags &MCL_FUTURE ) def_flags =VM_LOCKED ; - current->mm->def_flags = def_flags; + current->mm->def_flags |= def_flags;if (flags ==MCL_FUTURE ) goto out;
mm/vmalloc.c +1 -4
@@ -152,15 +152,12 @@ int map_vm_area(struct vm_struct *area,BUG_ON (addr >= end); pgd =pgd_offset_k (addr);do { -pgd_t oldpgd; -memcpy (&oldpgd,pgd,sizeof (pgd_t)); next =pgd_addr_end (addr, end); err =vmap_pud_range (pgd, addr, next, prot, pages);if (err)break ; -if (pgd_val (oldpgd) !=pgd_val (*pgd)) -set_pgdir (addr, *pgd); }while (pgd++, addr = next, addr != end); +__ipipe_update_all_pinned_mm ((unsigned long ) area->addr, end);flush_cache_vmap ((unsigned long ) area->addr, end);return err; }
arch/i386/mm/fault.c +15 -0
@@ -654,3 +654,18 @@ void vmalloc_sync_all(void) } }#endif + +#ifdef CONFIG_IPIPE +int __ipipe_pin_range_mapping (struct mm_struct *mm, +unsigned long start,unsigned long end) +{ +unsigned long next, addr = start; + +do { + next =pgd_addr_end (addr, end); +vmalloc_sync_one (mm->pgd, addr); + }while (addr = next, addr != end); + +return 0 ; +} +#endif /* CONFIG_IPIPE */
include/asm-i386/pgalloc.h +0 -23
@@ -46,27 +46,4 @@ static inline void pte_free(struct page#define check_pgt_cache () do { } while (0) -static inline void set_pgdir (unsigned long address,pgd_t entry) -{ -#ifdef CONFIG_IPIPE -struct task_struct * p; -struct page *page; -pgd_t *pgd; - -read_lock (&tasklist_lock); - -for_each_process (p) { -if (p->mm) - *pgd_offset (p->mm,address) = entry; - } - -read_unlock (&tasklist_lock); - -for (page = pgd_list; page; page = (struct page *)page->index) { - pgd = (pgd_t *)page_address (page); - pgd[address >>PGDIR_SHIFT ] = entry; - } -#endif /* CONFIG_IPIPE */ -} -#endif /* _I386_PGALLOC_H */
arch/arm/mm/fault.c +35 -3
@@ -330,6 +330,9 @@ do_translation_fault(unsigned long addr,if (addr <TASK_SIZE )return do_page_fault (addr, fsr, regs); +if (ipipe_trap_notify (IPIPE_TRAP_ACCESS ,regs)) +return 0 ; + index =pgd_index (addr);/*
@@ -354,9 +357,6 @@ do_translation_fault(unsigned long addr,return 0 ; bad_area: -if (ipipe_trap_notify (IPIPE_TRAP_ACCESS ,regs)) -return 0 ; -do_bad_area (addr, fsr, regs);return 0 ; }
@@ -479,3 +479,35 @@ do_PrefetchAbort(unsigned long addr, strdo_translation_fault (addr,0 , regs); } +#ifdef CONFIG_IPIPE +static void vmalloc_sync_one (pgd_t *pgd,unsigned long addr) +{ +unsigned int index =pgd_index (addr); +pgd_t *pgd_k; +pmd_t *pmd, *pmd_k; + + pgd += index; + pgd_k = init_mm.pgd + index; + +if (!pgd_present (*pgd)) +set_pgd (pgd, *pgd_k); + + pmd_k =pmd_offset (pgd_k, addr); + pmd =pmd_offset (pgd, addr); + +copy_pmd (pmd, pmd_k); +} + +int __ipipe_pin_range_mapping (struct mm_struct *mm, +unsigned long start,unsigned long end) +{ +unsigned long next, addr = start; + +do { + next =pgd_addr_end (addr, end); +vmalloc_sync_one (mm->pgd, addr); + }while (addr = next, addr != end); + +return 0 ; +} +#endif /* CONFIG_IPIPE */
include/asm-arm/pgalloc.h +0 -5
@@ -23,11 +23,6 @@#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL)) -static inline void set_pgdir (unsigned long address,pgd_t entry) -{ -/* nop */ -} -/* * Since we have only two-level page tables, these are trivial */