2.6.25-rc5-mm1: VM_MIXEDMAP, pte_special, xip series
Subsystems (11)
cover 2.6.25-rc5-mm1: VM_MIXEDMAP, pte_special, xip series
Signature · 54 lines
Hi, This series introduces some important infrastructure work that I hope can go in the next merge window. It has been quite widely reviewed and has had a bit of testing (I have just tested XIP on brd on 2.6.25-rc5-mm1). The overall result is that: 1. We now support XIP backed filesystems using memory that have no struct page allocated to them. And patches 6 and 7 actually implement this for s390. This is pretty important in a number of cases. As far as I understand, in the case of virtualisation (eg. s390), each guest may mount a readonly copy of the same filesystem (eg. the distro). Currently, guests need to allocate struct pages for this image. So if you have 100 guests, you already need to allocate more memory for the struct pages than the size of the image. I think. (Carsten?) For other (eg. embedded) systems, you may have a very large non- volatile filesystem. If you have to have struct pages for this, then your RAM consumption will go up proportionally to fs size. Even though it is just a small proportion, the RAM can be much more costly eg in terms of power, so every KB less that Linux uses makes it more attractive to a lot of these guys. 2. VM_MIXEDMAP allows us to support mappings where you actually do want to refcount _some_ pages in the mapping, but not others, and support COW on arbitrary (non-linear) mappings. Jared needs this for his NVRAM filesystem in progress. Future iterations of this filesystem will most likely want to migrate pages between pagecache and XIP backing, which is where the requirement for mixed (some refcounted, some not) comes from. 3. pte_special also has a peripheral usage that I need for my lockless get_user_pages patch. That was shown to speed up "oltp" on db2 by 10% on a 2 socket system, which is kind of significant because they scrounge for months to try to find 0.1% improvement on these workloads. I'm hoping we might finally be faster than AIX on pSeries with this :). My reference to lockless get_user_pages is not meant to justify this patchset (which doesn't include lockless gup), but just to show that pte_special is not some s390 specific thing that should be hidden in arch code or xip code: I definitely want to use it on at least x86 and powerpc as well. There are basically no clashes between mainline and -mm, btw. Thanks, Nick -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/7 mm: introduce VM_MIXEDMAP
Introduce a new type of mapping, VM_MIXEDMAP. This is unlike VM_PFNMAP in that it can support COW mappings of arbitrary ranges including ranges without struct page *and* ranges with a struct page that we actually want to refcount (PFNMAP can only support COW in those cases where the un-COW-ed translations are mapped linearly in the virtual address, and can only support non refcounted ranges).
VM_MIXEDMAP achieves this by refcounting all pfn_valid pages, and not refcounting !pfn_valid pages (which is not an option for VM_PFNMAP, because it needs to avoid refcounting pfn_valid pages eg. for /dev/mem mappings).
--- include/linux/mm.h | 1 mm/memory.c | 79 ++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 59 insertions(+), 21 deletions(-)
include/linux/mm.h +1 -0
@@ -107,6 +107,7 @@ extern unsigned int kobjsize(const void#define VM_ALWAYSDUMP 0x04000000/* Always include in core dumps */ #define VM_CAN_NONLINEAR 0x08000000/* Has ->fault & does nonlinear pages */ +#define VM_MIXEDMAP 0x10000000/* Can contain "struct page" and pure PFN pages */ #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
mm/memory.c +58 -21
117 lines not on this page · raw message
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerRe: [patch 1/7] mm: introduce VM_MIXEDMAP
Quoted 8 lines · On Fri, 28 Mar 2008 12:52:39 +1100 [email protected] wrote:
From: [email protected]
From: Jared Hulbert <[email protected]>
To: [email protected]
Cc: Linus Torvalds <[email protected]>, Jared Hulbert <[email protected]>, Carsten Otte <[email protected]>, Martin Schwidefsky <[email protected]>, Heiko Carstens <[email protected]>, [email protected]
Subject: [patch 1/7] mm: introduceVM_MIXEDMAP
Date: Fri, 28 Mar 2008 12:52:39 +1100
Sender: [email protected]
User-Agent: quilt/0.46-14
It's unusual to embed the original author's From: line in the headers like that - it is usually placed in the message body and this arrangement might fool some people's scripts.
patch 6/7 was subtly hidden, concatenated to 5/7, but I found it.
[7/7] needs to be redone please - git-s390 makes functional changes to add_shared_memory().
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [patch 1/7] mm: introduce VM_MIXEDMAP
Quoted 12 lines · Andrew Morton
Quoted 8 lines · On Fri, 28 Mar 2008 12:52:39 +1100 [email protected] wrote:
From: [email protected]
From: Jared Hulbert <[email protected]>
To: [email protected]
Cc: Linus Torvalds <[email protected]>, Jared Hulbert <[email protected]>, Carsten Otte <[email protected]>, Martin Schwidefsky <[email protected]>, Heiko Carstens <[email protected]>, [email protected]
Subject: [patch 1/7] mm: introduceVM_MIXEDMAP
Date: Fri, 28 Mar 2008 12:52:39 +1100
Sender: [email protected]
User-Agent: quilt/0.46-14
Quoted 3 lines
It's unusual to embed the original author's From: line in the headers like that - it is usually placed in the message body and this arrangement might fool some people's scripts.
Hmm, OK. I guess either quilt or my sendmbox script messed up.
Quoted 1 line
patch 6/7 was subtly hidden, concatenated to 5/7, but I found it.
Oh? :( That came out of quilt send as well... I guess it is my script. Thanks for untangling it.
Quoted 2 lines
[7/7] needs to be redone please - git-s390 makes functional changes to
add_shared_memory().
I'll let one of the s390 folk send you a patch when they feel like it.
Regarding the lockless get_user_pages patches... it would be nice to get them into -mm as well. They haven't had as much review as these patches, but at least they did survive an OLTP run at IBM, so they should be OK to sit in -mm I think (unless you have to many clashes).
Thanks,
Nick
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [patch 1/7] mm: introduce VM_MIXEDMAP
In reply to Andrew MortonAm Montag, den 31.03.2008, 15:04 -0700 schrieb Andrew Morton:
Quoted 2 lines
[7/7] needs to be redone please - git-s390 makes functional changes to
add_shared_memory().
This patch removes struct page entries for DCSS segments that are being loaded. They can still be accessed correctly, thanks to the struct page-less XIP work of previous patches.
--- arch/s390/mm/vmem.c | 18 +----------------- 1 files changed, 1 insertion(+), 17 deletions(-)
arch/s390/mm/vmem.c +1 -17
@@ -343,8 +343,6 @@ out:int add_shared_memory (unsigned long start,unsigned long size) {struct memory_segment *seg; -struct page *page; -unsigned long pfn, num_pfn, end_pfn;int ret;mutex_lock (&vmem_mutex);
@@ -359,24 +357,10 @@ int add_shared_memory(unsigned long starif (ret) goto out_free; - ret =vmem_add_mem (start, size,0 ); + ret =vmem_add_range (start, size,0 );if (ret) goto out_remove; - pfn =PFN_DOWN (start); - num_pfn =PFN_DOWN (size); - end_pfn = pfn + num_pfn; - - page =pfn_to_page (pfn); -memset (page,0 , num_pfn *sizeof (struct page )); - -for (; pfn < end_pfn; pfn++) { - page =pfn_to_page (pfn); -init_page_count (page); -reset_page_mapcount (page); -SetPageReserved (page); -INIT_LIST_HEAD (&page->lru); - } goto out; out_remove:
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/7 mm: introduce pte_special pte bit
In reply to [email protected]s390 for one, cannot implement VM_MIXEDMAP with pfn_valid, due to their memory model (which is more dynamic than most). Instead, they had proposed to implement it with an additional path through vm_normal_page(), using a bit in the pte to determine whether or not the page should be refcounted:
vm_normal_page()
{
...
if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
if (vma->vm_flags & VM_MIXEDMAP) {
#ifdef s390
if (!mixedmap_refcount_pte(pte))
return NULL;
#else
if (!pfn_valid(pfn))
return NULL;
#endif
goto out;
}
...
}This is fine, however if we are allowed to use a bit in the pte to determine refcountedness, we can use that to _completely_ replace all the vma based schemes. So instead of adding more cases to the already complex vma-based scheme, we can have a clearly seperate and simple pte-based scheme (and get slightly better code generation in the process):
vm_normal_page()
{
#ifdef s390 if (!mixedmap_refcount_pte(pte)) return NULL; return pte_page(pte); #else ...
#endif
}
And finally, we may rather make this concept usable by any architecture rather than making it s390 only, so implement a new type of pte state for this. Unfortunately the old vma based code must stay, because some architectures may not be able to spare pte bits. This makes vm_normal_page a little bit more ugly than we would like, but the 2 cases are clearly seperate.
So introduce a pte_special pte state, and use it in mm/memory.c. It is currently a noop for all architectures, so this doesn't actually result in any compiled code changes to mm/memory.o.
BTW:
I haven't put vm_normal_page() into arch code as-per an earlier suggestion. The reason is that, regardless of where vm_normal_page is actually implemented, the *abstraction* is still exactly the same. Also, while it depends on whether the architecture has pte_special or not, that is the only two possible cases, and it really isn't an arch specific function -- the role of the arch code should be to provide primitive functions and accessors with which to build the core code; pte_special does that. We do not want architectures to know or care about vm_normal_page itself, and we definitely don't want them being able to invent something new there out of sight of mm/ code. If we made vm_normal_page an arch function, then we have to make vm_insert_mixed (next patch) an arch function too. So I don't think moving it to arch code fundamentally improves any abstractions, while it does practically make the code more difficult to follow, for both mm and arch developers, and easier to misuse.
--- include/asm-alpha/pgtable.h | 2 include/asm-avr32/pgtable.h | 8 ++ include/asm-cris/pgtable.h | 2 include/asm-frv/pgtable.h | 2 include/asm-ia64/pgtable.h | 3 + include/asm-m32r/pgtable.h | 10 +++ include/asm-m68k/motorola_pgtable.h | 2 include/asm-m68k/sun3_pgtable.h | 2 include/asm-mips/pgtable.h | 2 include/asm-parisc/pgtable.h | 2 include/asm-powerpc/pgtable-ppc32.h | 3 + include/asm-powerpc/pgtable-ppc64.h | 3 + include/asm-ppc/pgtable.h | 3 + include/asm-s390/pgtable.h | 10 +++ include/asm-sh64/pgtable.h | 2 include/asm-sparc/pgtable.h | 7 ++ include/asm-sparc64/pgtable.h | 10 +++ include/asm-um/pgtable.h | 10 +++ include/asm-x86/pgtable_32.h | 2 include/asm-x86/pgtable_64.h | 2 include/asm-xtensa/pgtable.h | 4 + include/linux/mm.h | 3 - mm/memory.c | 98 +++++++++++++++++++----------------- 23 files changed, 147 insertions(+), 45 deletions(-)
include/asm-um/pgtable.h +10 -0
@@ -173,6 +173,11 @@ static inline int pte_newprot(pte_t pte)return (pte_present (pte) && (pte_get_bits (pte, _PAGE_NEWPROT))); } +static inline int pte_special (pte_t pte) +{ +return 0 ; +} +/* * ================================= * Flags setting section.
@@ -241,6 +246,11 @@ static inline pte_t pte_mknewpage(pte_treturn (pte); } +static inline pte_t pte_mkspecial (pte_t pte) +{ +return (pte); +} +static inline void set_pte (pte_t *pteptr,pte_t pteval) {pte_copy (*pteptr, pteval);
include/linux/mm.h +3 -1
@@ -704,7 +704,9 @@ struct zap_details {unsigned long truncate_count;/* Compare vm_truncate_count */ }; -struct page *vm_normal_page (struct vm_area_struct *,unsigned long ,pte_t ); +struct page *vm_normal_page (struct vm_area_struct *vma,unsigned long addr, +pte_t pte); +unsigned long zap_page_range (struct vm_area_struct *vma,unsigned long address,unsigned long size,struct zap_details *); unsigned long unmap_vmas(struct mmu_gather **tlb,
mm/memory.c +56 -45
158 lines not on this page · raw message
include/asm-alpha/pgtable.h +2 -0
@@ -268,6 +268,7 @@ extern inline int pte_write(pte_t pte)extern inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }extern inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }extern inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +extern inline int pte_special (pte_t pte) {return 0 ; }extern inline pte_t pte_wrprotect (pte_t pte) {pte_val (pte) |= _PAGE_FOW;return pte; }extern inline pte_t pte_mkclean (pte_t pte) {pte_val (pte) &= ~(__DIRTY_BITS);return pte; }
@@ -275,6 +276,7 @@ extern inline pte_t pte_mkold(pte_t pte)extern inline pte_t pte_mkwrite (pte_t pte) {pte_val (pte) &= ~_PAGE_FOW;return pte; }extern inline pte_t pte_mkdirty (pte_t pte) {pte_val (pte) |= __DIRTY_BITS;return pte; }extern inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= __ACCESS_BITS;return pte; } +extern inline pte_t pte_mkspecial (pte_t pte) {return pte; }#define PAGE_DIR_OFFSET (tsk,address) pgd_offset((tsk),(address))
include/asm-avr32/pgtable.h +8 -0
@@ -212,6 +212,10 @@ static inline int pte_young(pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; } +static inline int pte_special (pte_t pte) +{ +return 0 ; +}/* * The following only work if pte_present() is not true.
@@ -252,6 +256,10 @@ static inline pte_t pte_mkyoung(pte_t ptset_pte (&pte,__pte (pte_val (pte) | _PAGE_ACCESSED));return pte; } +static inline pte_t pte_mkspecial (pte_t pte) +{ +return pte; +}#define pmd_none (x) (!pmd_val(x))#define pmd_present (x) (pmd_val(x) & _PAGE_PRESENT)
include/asm-cris/pgtable.h +2 -0
@@ -115,6 +115,7 @@ static inline int pte_write(pte_t pte)static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_MODIFIED; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline pte_t pte_wrprotect (pte_t pte) {
@@ -162,6 +163,7 @@ static inline pte_t pte_mkyoung(pte_t pt }return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }/* * Conversion functions: convert a page and protection to a page entry,
include/asm-frv/pgtable.h +2 -0
@@ -380,6 +380,7 @@ static inline pmd_t *pmd_offset(pud_t *dstatic inline int pte_dirty (pte_t pte) {return (pte).pte & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return (pte).pte & _PAGE_ACCESSED; }static inline int pte_write (pte_t pte) {return !((pte).pte & _PAGE_WP); } +static inline int pte_special (pte_t pte) {return 0 ; }static inline pte_t pte_mkclean (pte_t pte) { (pte).pte &= ~_PAGE_DIRTY;return pte; }static inline pte_t pte_mkold (pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED;return pte; }
@@ -387,6 +388,7 @@ static inline pte_t pte_wrprotect(pte_tstatic inline pte_t pte_mkdirty (pte_t pte) { (pte).pte |= _PAGE_DIRTY;return pte; }static inline pte_t pte_mkyoung (pte_t pte) { (pte).pte |= _PAGE_ACCESSED;return pte; }static inline pte_t pte_mkwrite (pte_t pte) { (pte).pte &= ~_PAGE_WP;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }static inline int ptep_test_and_clear_young (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep) {
include/asm-ia64/pgtable.h +3 -0
@@ -302,6 +302,8 @@ ia64_phys_addr_valid (unsigned long addr#define pte_dirty (pte) ((pte_val(pte) & _PAGE_D) != 0)#define pte_young (pte) ((pte_val(pte) & _PAGE_A) != 0)#define pte_file (pte) ((pte_val(pte) & _PAGE_FILE) != 0) +#define pte_special (pte) 0 +/* * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the * access rights:
@@ -313,6 +315,7 @@ ia64_phys_addr_valid (unsigned long addr#define pte_mkclean (pte) (__pte(pte_val(pte) & ~_PAGE_D))#define pte_mkdirty (pte) (__pte(pte_val(pte) | _PAGE_D))#define pte_mkhuge (pte) (__pte(pte_val(pte))) +#define pte_mkspecial (pte) (pte)/* * Because ia64's Icache and Dcache is not coherent (on a cpu), we need to
include/asm-m32r/pgtable.h +10 -0
@@ -214,6 +214,11 @@ static inline int pte_file(pte_t pte)return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) +{ +return 0 ; +} +static inline pte_t pte_mkclean (pte_t pte) {pte_val (pte) &= ~_PAGE_DIRTY;
@@ -250,6 +255,11 @@ static inline pte_t pte_mkwrite(pte_t ptreturn pte; } +static inline pte_t pte_mkspecial (pte_t pte) +{ +return pte; +} +static inline int ptep_test_and_clear_young (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep) {return test_and_clear_bit (_PAGE_BIT_ACCESSED, ptep);
include/asm-m68k/motorola_pgtable.h +2 -0
@@ -168,6 +168,7 @@ static inline int pte_write(pte_t pte)static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline pte_t pte_wrprotect (pte_t pte) {pte_val (pte) |= _PAGE_RONLY;return pte; }static inline pte_t pte_mkclean (pte_t pte) {pte_val (pte) &= ~_PAGE_DIRTY;return pte; }
@@ -185,6 +186,7 @@ static inline pte_t pte_mkcache(pte_t ptpte_val (pte) = (pte_val (pte) & _CACHEMASK040) | m68k_supervisor_cachemode;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }#define PAGE_DIR_OFFSET (tsk,address) pgd_offset((tsk),(address))
include/asm-m68k/sun3_pgtable.h +2 -0
@@ -169,6 +169,7 @@ static inline int pte_write(pte_t pte)static inline int pte_dirty (pte_t pte) {return pte_val (pte) &SUN3_PAGE_MODIFIED ; }static inline int pte_young (pte_t pte) {return pte_val (pte) &SUN3_PAGE_ACCESSED ; }static inline int pte_file (pte_t pte) {return pte_val (pte) &SUN3_PAGE_ACCESSED ; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline pte_t pte_wrprotect (pte_t pte) {pte_val (pte) &= ~SUN3_PAGE_WRITEABLE ;return pte; }static inline pte_t pte_mkclean (pte_t pte) {pte_val (pte) &= ~SUN3_PAGE_MODIFIED ;return pte; }
@@ -181,6 +182,7 @@ static inline pte_t pte_mknocache(pte_t//static inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; } // until then, use: static inline pte_t pte_mkcache (pte_t pte) {return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }extern pgd_t swapper_pg_dir[PTRS_PER_PGD ];extern pgd_t kernel_pg_dir[PTRS_PER_PGD ];
include/asm-mips/pgtable.h +2 -0
@@ -292,6 +292,8 @@ static inline pte_t pte_mkyoung(pte_t pt return pte; }#endif +static inline int pte_special (pte_t pte) {return 0 ; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }/* * Macro to make mark a page protection value as "uncacheable". Note
include/asm-parisc/pgtable.h +2 -0
@@ -323,6 +323,7 @@ static inline int pte_dirty(pte_t pte)static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_write (pte_t pte) {return pte_val (pte) & _PAGE_WRITE; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline pte_t pte_mkclean (pte_t pte) {pte_val (pte) &= ~_PAGE_DIRTY;return pte; }static inline pte_t pte_mkold (pte_t pte) {pte_val (pte) &= ~_PAGE_ACCESSED;return pte; }
@@ -330,6 +331,7 @@ static inline pte_t pte_wrprotect(pte_tstatic inline pte_t pte_mkdirty (pte_t pte) {pte_val (pte) |= _PAGE_DIRTY;return pte; }static inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED;return pte; }static inline pte_t pte_mkwrite (pte_t pte) {pte_val (pte) |= _PAGE_WRITE;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }/* * Conversion functions: convert a page and protection to a page entry,
include/asm-powerpc/pgtable-ppc32.h +3 -0
@@ -506,6 +506,7 @@ static inline int pte_write(pte_t pte)static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline void pte_uncache (pte_t pte) {pte_val (pte) |= _PAGE_NO_CACHE; }static inline void pte_cache (pte_t pte) {pte_val (pte) &= ~_PAGE_NO_CACHE; }
@@ -523,6 +524,8 @@ static inline pte_t pte_mkdirty(pte_t ptpte_val (pte) |= _PAGE_DIRTY;return pte; }static inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) { +return pte; }static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) {
include/asm-powerpc/pgtable-ppc64.h +3 -0
@@ -239,6 +239,7 @@ static inline int pte_write(pte_t pte) {static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY;}static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED;}static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE;} +static inline int pte_special (pte_t pte) {return 0 ; }static inline void pte_uncache (pte_t pte) {pte_val (pte) |= _PAGE_NO_CACHE; }static inline void pte_cache (pte_t pte) {pte_val (pte) &= ~_PAGE_NO_CACHE; }
@@ -257,6 +258,8 @@ static inline pte_t pte_mkyoung(pte_t ptpte_val (pte) |= _PAGE_ACCESSED;return pte; }static inline pte_t pte_mkhuge (pte_t pte) {return pte; } +static inline pte_t pte_mkspecial (pte_t pte) { +return pte; }/* Atomic PTE updates */ static inline unsigned long pte_update(struct mm_struct *mm,
include/asm-ppc/pgtable.h +3 -0
@@ -491,6 +491,7 @@ static inline int pte_write(pte_t pte)static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; }static inline void pte_uncache (pte_t pte) {pte_val (pte) |= _PAGE_NO_CACHE; }static inline void pte_cache (pte_t pte) {pte_val (pte) &= ~_PAGE_NO_CACHE; }
@@ -508,6 +509,8 @@ static inline pte_t pte_mkdirty(pte_t ptpte_val (pte) |= _PAGE_DIRTY;return pte; }static inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) { +return pte; }static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) {
include/asm-s390/pgtable.h +10 -0
@@ -510,6 +510,11 @@ static inline int pte_file(pte_t pte)return (pte_val (pte) & mask) == _PAGE_TYPE_FILE; } +static inline int pte_special (pte_t pte) +{ +return 0 ; +} +#define __HAVE_ARCH_PTE_SAME#define pte_same (a,b) (pte_val(a) == pte_val(b))
@@ -663,6 +668,11 @@ static inline pte_t pte_mkyoung(pte_t ptreturn pte; } +static inline pte_t pte_mkspecial (pte_t pte) +{ +return pte; +} +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNGstatic inline int ptep_test_and_clear_young (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep)
include/asm-sparc/pgtable.h +7 -0
@@ -219,6 +219,11 @@ static inline int pte_file(pte_t pte)return pte_val (pte) &BTFIXUP_HALF (pte_filei); } +static inline int pte_special (pte_t pte) +{ +return 0 ; +} +/* */ BTFIXUPDEF_HALF (pte_wrprotecti)
@@ -251,6 +256,8 @@ BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung#define pte_mkdirty (pte) BTFIXUP_CALL(pte_mkdirty)(pte)#define pte_mkyoung (pte) BTFIXUP_CALL(pte_mkyoung)(pte) +#define pte_mkspecial(pte_t pte) (pte) +#define pfn_pte (pfn, prot) mk_pte(pfn_to_page(pfn), prot) BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t)
include/asm-sparc64/pgtable.h +10 -0
@@ -506,6 +506,11 @@ static inline pte_t pte_mkyoung(pte_t ptreturn __pte (pte_val (pte) | mask); } +static inline pte_t pte_mkspecial (pte_t pte) +{ +return pte; +} +static inline unsigned long pte_young (pte_t pte) {unsigned long mask;
@@ -608,6 +613,11 @@ static inline unsigned long pte_present(return val; } +static inline int pte_special (pte_t pte) +{ +return 0 ; +} +#define pmd_set (pmdp, ptep) \ (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL))#define pud_set (pudp, pmdp) \
include/asm-xtensa/pgtable.h +4 -0
@@ -210,6 +210,8 @@ static inline int pte_write(pte_t pte) {static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_special (pte_t pte) {return 0 ; } +static inline pte_t pte_wrprotect (pte_t pte) {pte_val (pte) &= ~(_PAGE_WRITABLE | _PAGE_HW_WRITE);return pte; }static inline pte_t pte_mkclean (pte_t pte)
@@ -222,6 +224,8 @@ static inline pte_t pte_mkyoung(pte_t pt {pte_val (pte) |= _PAGE_ACCESSED;return pte; }static inline pte_t pte_mkwrite (pte_t pte) {pte_val (pte) |= _PAGE_WRITABLE;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) + {return pte; }/* * Conversion functions: convert a page and protection to a page entry,
include/asm-x86/pgtable.h +2 -0
@@ -149,6 +149,7 @@ static inline int pte_file(pte_t pte) {static inline int pte_huge (pte_t pte) {return pte_val (pte) & _PAGE_PSE; }static inline int pte_global (pte_t pte) {return pte_val (pte) & _PAGE_GLOBAL; }static inline int pte_exec (pte_t pte) {return !(pte_val (pte) & _PAGE_NX); } +static inline int pte_special (pte_t pte) {return 0 ; }static inline int pmd_large (pmd_t pte) { return (pmd_val(pte) & (_PAGE_PSE|_PAGE_PRESENT)) ==
@@ -166,6 +167,7 @@ static inline pte_t pte_mkhuge(pte_t ptestatic inline pte_t pte_clrhuge (pte_t pte) {return __pte (pte_val (pte) & ~(pteval_t )_PAGE_PSE); }static inline pte_t pte_mkglobal (pte_t pte) {return __pte (pte_val (pte) | _PAGE_GLOBAL); }static inline pte_t pte_clrglobal (pte_t pte) {return __pte (pte_val (pte) & ~(pteval_t )_PAGE_GLOBAL); } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }extern pteval_t __supported_pte_mask;
include/asm-mn10300/pgtable.h +3 -0
@@ -224,6 +224,7 @@ static inline int pte_read(pte_t pte) {static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_write (pte_t pte) {return pte_val (pte) & __PAGE_PROT_WRITE; } +static inline int pte_special (pte_t pte){return 0 ; }/* * The following only works if pte_present() is not true.
@@ -265,6 +266,8 @@ static inline pte_t pte_mkwrite(pte_t ptreturn pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; } +#define pte_ERROR (e) \ printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ __FILE__, __LINE__, pte_val(e))
include/asm-sh/pgtable_32.h +3 -0
@@ -326,6 +326,7 @@ static inline void set_pte(pte_t *ptep,#define pte_dirty (pte) ((pte).pte_low & _PAGE_DIRTY)#define pte_young (pte) ((pte).pte_low & _PAGE_ACCESSED)#define pte_file (pte) ((pte).pte_low & _PAGE_FILE) +#define pte_special (pte) (0)#ifdef CONFIG_X2TLB #define pte_write (pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
@@ -356,6 +357,8 @@ PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRT PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED); PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED); +static inline pte_t pte_mkspecial (pte_t pte) {return pte; } +/* * Macro and implementation to make a page protection as uncachable. */
include/asm-sh/pgtable_64.h +6 -4
@@ -254,10 +254,11 @@ extern void __handle_bad_pmd_kernel(pmd_/* * The following have defined behavior only work if pte_present() is true. */ -static inline int pte_dirty (pte_t pte){return pte_val (pte) & _PAGE_DIRTY; } -static inline int pte_young (pte_t pte){return pte_val (pte) & _PAGE_ACCESSED; } -static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } -static inline int pte_write (pte_t pte){return pte_val (pte) & _PAGE_WRITE; } +static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; } +static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; } +static inline int pte_file (pte_t pte) {return pte_val (pte) & _PAGE_FILE; } +static inline int pte_write (pte_t pte) {return pte_val (pte) & _PAGE_WRITE; } +static inline int pte_special (pte_t pte){return 0 ; }static inline pte_t pte_wrprotect (pte_t pte) {set_pte (&pte,__pte (pte_val (pte) & ~_PAGE_WRITE));return pte; }static inline pte_t pte_mkclean (pte_t pte) {set_pte (&pte,__pte (pte_val (pte) & ~_PAGE_DIRTY));return pte; }
@@ -266,6 +267,7 @@ static inline pte_t pte_mkwrite(pte_t ptstatic inline pte_t pte_mkdirty (pte_t pte) {set_pte (&pte,__pte (pte_val (pte) | _PAGE_DIRTY));return pte; }static inline pte_t pte_mkyoung (pte_t pte) {set_pte (&pte,__pte (pte_val (pte) | _PAGE_ACCESSED));return pte; }static inline pte_t pte_mkhuge (pte_t pte) {set_pte (&pte,__pte (pte_val (pte) | _PAGE_SZHUGE));return pte; } +static inline pte_t pte_mkspecial (pte_t pte) {return pte; }/*
include/asm-arm/pgtable.h +3 -0
@@ -260,6 +260,7 @@ extern struct page *empty_zero_page;#define pte_write (pte) (pte_val(pte) & L_PTE_WRITE)#define pte_dirty (pte) (pte_val(pte) & L_PTE_DIRTY)#define pte_young (pte) (pte_val(pte) & L_PTE_YOUNG) +#define pte_special (pte) (0)/* * The following only works if pte_present() is not true.
@@ -280,6 +281,8 @@ PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY); PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); +static inline pte_t pte_mkspecial (pte_t pte) {return pte; } +/* * Mark the prot value as uncacheable and unbufferable. */
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/7 mm: add vm_insert_mixed
In reply to [email protected]vm_insert_mixed will insert either a raw pfn or a refcounted struct page into the page tables, depending on whether vm_normal_page() will return the page or not. With the introduction of the new pte bit, this is now a too tricky for drivers to be doing themselves.
filemap_xip uses this in a subsequent patch.
--- include/linux/mm.h | 2 + mm/memory.c | 79 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 24 deletions(-)
include/linux/mm.h +2 -0
@@ -1148,6 +1148,8 @@ int remap_pfn_range(struct vm_area_strucint vm_insert_page (struct vm_area_struct *,unsigned long addr,struct page *);int vm_insert_pfn (struct vm_area_struct *vma,unsigned long addr,unsigned long pfn); +int vm_insert_mixed (struct vm_area_struct *vma,unsigned long addr, +unsigned long pfn);struct page *follow_page (struct vm_area_struct *,unsigned long address,unsigned int foll_flags);
mm/memory.c +60 -26
125 lines not on this page · raw message
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/7 return pfn from direct_access, for XIP
In reply to [email protected]Alter the block device ->direct_access() API to work with the new get_xip_mem() API (that requires both kaddr and pfn are returned).
Some architectures will not do the right thing in their virt_to_page() for use by XIP (to translate from the kernel virtual address returned by direct_access(), to a user mappable pfn in XIP's page fault handler.
However, we can't switch it to just return the pfn and not the kaddr, because we have no good way to get a kva from a pfn, and XIP requires the kva for its read(2) and write(2) handlers. So we have to return both.
---
arch/powerpc/sysdev/axonram.c +3 -2
@@ -143,7 +143,7 @@ axon_ram_make_request(struct request_que*/ static int axon_ram_direct_access (struct block_device *device,sector_t sector, -unsigned long *data) +void **kaddr,unsigned long *pfn) {struct axon_ram_bank *bank = device->bd_disk->private_data;loff_t offset;
@@ -154,7 +154,8 @@ axon_ram_direct_access(struct block_devireturn -ERANGE ; } - *data = bank->ph_addr + offset; + *kaddr = (void *)(bank->ph_addr + offset); + *pfn =virt_to_phys (kaddr) >>PAGE_SHIFT ;return 0 ; }
drivers/block/brd.c +3 -2
@@ -319,7 +319,7 @@ out:#ifdef CONFIG_BLK_DEV_XIP static int brd_direct_access (struct block_device *bdev,sector_t sector, -unsigned long *data) +void **kaddr,unsigned long *pfn) {struct brd_device *brd = bdev->bd_disk->private_data;struct page *page;
@@ -333,7 +333,8 @@ static int brd_direct_access (struct blo page =brd_insert_page (brd, sector);if (!page)return -ENOMEM ; - *data = (unsigned long )page_address (page); + *kaddr =page_address (page); + *pfn =page_to_pfn (page);return 0 ; }
drivers/s390/block/dcssblk.c +5 -3
@@ -36,7 +36,7 @@ static int dcssblk_open(struct inode *instatic int dcssblk_release (struct inode *inode,struct file *filp);static int dcssblk_make_request (struct request_queue *q,struct bio *bio);static int dcssblk_direct_access (struct block_device *bdev,sector_t secnum, -unsigned long *data); +void **kaddr,unsigned long *pfn);static char dcssblk_segments[DCSSBLK_PARM_LEN ] ="\0" ;
@@ -687,7 +687,7 @@ fail:static int dcssblk_direct_access (struct block_device *bdev,sector_t secnum, -unsigned long *data) +void **kaddr,unsigned long *pfn) {struct dcssblk_dev_info *dev_info;unsigned long pgoff;
@@ -700,7 +700,9 @@ dcssblk_direct_access (struct block_devi pgoff = secnum / (PAGE_SIZE /512 );if ((pgoff+1 )*PAGE_SIZE -1 > dev_info->end - dev_info->start)return -ERANGE ; - *data = (unsigned long ) (dev_info->start+pgoff*PAGE_SIZE ); + *kaddr = (void *) (dev_info->start+pgoff*PAGE_SIZE ); + *pfn =virt_to_phys (*kaddr) >>PAGE_SHIFT ; +return 0 ; }
include/linux/fs.h +2 -1
@@ -1178,7 +1178,8 @@ struct block_device_operations {int (*ioctl) (struct inode *,struct file *,unsigned ,unsigned long );long (*unlocked_ioctl) (struct file *,unsigned ,unsigned long );long (*compat_ioctl) (struct file *,unsigned ,unsigned long ); -int (*direct_access) (struct block_device *,sector_t ,unsigned long *); +int (*direct_access) (struct block_device *,sector_t , +void **,unsigned long *);int (*media_changed) (struct gendisk *);int (*revalidate_disk) (struct gendisk *);int (*getgeo)(struct block_device *,struct hd_geometry *);
fs/ext2/xip.c +14 -10
@@ -16,11 +16,13 @@static inline int __inode_direct_access (struct inode *inode,sector_t sector, -unsigned long *data) +void **kaddr,unsigned long *pfn) { -BUG_ON (!inode->i_sb->s_bdev->bd_disk->fops->direct_access); -return inode->i_sb->s_bdev->bd_disk->fops - ->direct_access (inode->i_sb->s_bdev,sector,data); +struct block_device *bdev = inode->i_sb->s_bdev; +struct block_device_operations *ops = bdev->bd_disk->fops; + +BUG_ON (!ops->direct_access); +return ops->direct_access (bdev, sector, kaddr, pfn); } static inline int
@@ -48,12 +50,13 @@ int ext2_clear_xip_target(struct inode *inode, int block) {sector_t sector = block * (PAGE_SIZE /512 ); -unsigned long data; +void *kaddr; +unsigned long pfn;int rc; - rc =__inode_direct_access (inode, sector, &data); + rc =__inode_direct_access (inode, sector, &kaddr, &pfn);if (!rc) -clear_page ((void *)data); +clear_page (kaddr);return rc; }
@@ -74,7 +77,8 @@ ext2_get_xip_page(struct address_space * int create) {int rc; -unsigned long data; +void *kaddr; +unsigned long pfn;sector_t sector;/* first, retrieve the sector number */
@@ -84,9 +88,9 @@ ext2_get_xip_page(struct address_space */* retrieve address of the target data */ rc =__inode_direct_access - (mapping->host, sector * (PAGE_SIZE /512 ), &data); + (mapping->host, sector * (PAGE_SIZE /512 ), &kaddr, &pfn);if (!rc) -return virt_to_page (data); +return pfn_to_page (pfn); error:return ERR_PTR (rc);
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/7 xip: support non-struct page backed memory
In reply to [email protected]Convert XIP to support non-struct page backed memory, using VM_MIXEDMAP for the user mappings.
This requires the get_xip_page API to be changed to an address based one. Improve the API layering a little bit too, while we're here.
This is required in order to support XIP filesystems on memory that isn't backed with struct page (but memory with struct page is still supported too).
--- fs/ext2/inode.c | 2 fs/ext2/xip.c | 36 ++++----- fs/ext2/xip.h | 8 +- fs/open.c | 2 include/linux/fs.h | 3 mm/fadvise.c | 2 mm/filemap_xip.c | 191 ++++++++++++++++++++++++++--------------------------- mm/madvise.c | 2 8 files changed, 122 insertions(+), 124 deletions(-)
fs/ext2/inode.c +1 -1
@@ -795,7 +795,7 @@ const struct address_space_operations exconst struct address_space_operations ext2_aops_xip = { .bmap = ext2_bmap, - .get_xip_page = ext2_get_xip_page, + .get_xip_mem = ext2_get_xip_mem, };const struct address_space_operations ext2_nobh_aops = {
fs/ext2/xip.c +15 -22
@@ -15,26 +15,28 @@#include "xip.h" static inline int -__inode_direct_access (struct inode *inode,sector_t sector, +__inode_direct_access (struct inode *inode,sector_t block,void **kaddr,unsigned long *pfn) {struct block_device *bdev = inode->i_sb->s_bdev;struct block_device_operations *ops = bdev->bd_disk->fops; +sector_t sector; + + sector = block * (PAGE_SIZE /512 );/* ext2 block to bdev sector */ BUG_ON (!ops->direct_access);return ops->direct_access (bdev, sector, kaddr, pfn); }static inline int -__ext2_get_sector (struct inode *inode,sector_t offset,int create, +__ext2_get_block (struct inode *inode,pgoff_t pgoff,int create,sector_t *result) {struct buffer_head tmp;int rc;memset (&tmp,0 ,sizeof (struct buffer_head )); - rc =ext2_get_block (inode, offset/ (PAGE_SIZE /512 ), &tmp, - create); + rc =ext2_get_block (inode, pgoff, &tmp, create); *result = tmp.b_blocknr;/* did we get a sparse block (hole in the file)? */
@@ -47,14 +49,13 @@ __ext2_get_sector(struct inode *inode, s }int -ext2_clear_xip_target (struct inode *inode,int block) +ext2_clear_xip_target (struct inode *inode,sector_t block) { -sector_t sector = block * (PAGE_SIZE /512 );void *kaddr;unsigned long pfn;int rc; - rc =__inode_direct_access (inode, sector, &kaddr, &pfn); + rc =__inode_direct_access (inode, block, &kaddr, &pfn);if (!rc)clear_page (kaddr);return rc;
@@ -72,26 +73,18 @@ void ext2_xip_verify_sb(struct super_blo } } -struct page * -ext2_get_xip_page (struct address_space *mapping,sector_t offset, -int create) +int ext2_get_xip_mem (struct address_space *mapping,pgoff_t pgoff,int create, +void **kmem,unsigned long *pfn) {int rc; -void *kaddr; -unsigned long pfn; -sector_t sector; +sector_t block;/* first, retrieve the sector number */ - rc =__ext2_get_sector (mapping->host, offset, create, §or); + rc =__ext2_get_block (mapping->host, pgoff, create, &block);if (rc) - goto error; +return rc;/* retrieve address of the target data */ - rc =__inode_direct_access - (mapping->host, sector * (PAGE_SIZE /512 ), &kaddr, &pfn); -if (!rc) -return pfn_to_page (pfn); - - error: -return ERR_PTR (rc); + rc =__inode_direct_access (mapping->host, block, kmem, pfn); +return rc; }
fs/ext2/xip.h +5 -4
@@ -7,19 +7,20 @@#ifdef CONFIG_EXT2_FS_XIP extern void ext2_xip_verify_sb (struct super_block *); -extern int ext2_clear_xip_target (struct inode *,int ); +extern int ext2_clear_xip_target (struct inode *,sector_t );static inline int ext2_use_xip (struct super_block *sb) {struct ext2_sb_info *sbi =EXT2_SB (sb);return (sbi->s_mount_opt &EXT2_MOUNT_XIP ); } -struct page *ext2_get_xip_page (struct address_space *,sector_t ,int ); -#define mapping_is_xip (map) unlikely(map->a_ops->get_xip_page) +int ext2_get_xip_mem (struct address_space *,pgoff_t ,int , +void **,unsigned long *); +#define mapping_is_xip (map) unlikely(map->a_ops->get_xip_mem)#else #define mapping_is_xip (map) 0#define ext2_xip_verify_sb (sb) do { } while (0)#define ext2_use_xip (sb) 0#define ext2_clear_xip_target (inode, chain) 0 -#define ext2_get_xip_page NULL +#define ext2_get_xip_mem NULL#endif
fs/open.c +1 -1
@@ -837,7 +837,7 @@ static struct file *__dentry_open(structif (f->f_flags &O_DIRECT ) {if (!f->f_mapping->a_ops || ((!f->f_mapping->a_ops->direct_IO) && - (!f->f_mapping->a_ops->get_xip_page))) { + (!f->f_mapping->a_ops->get_xip_mem))) {fput (f); f =ERR_PTR (-EINVAL ); }
include/linux/fs.h +2 -2
@@ -475,8 +475,8 @@ struct address_space_operations {int (*releasepage) (struct page *,gfp_t );ssize_t (*direct_IO)(int ,struct kiocb *,const struct iovec *iov,loff_t offset,unsigned long nr_segs); -struct page * (*get_xip_page)(struct address_space *,sector_t , -int ); +int (*get_xip_mem)(struct address_space *,pgoff_t ,int , +void **,unsigned long *);/* migrate the contents of a page to the specified target */ int (*migratepage) (struct address_space *,struct page *,struct page *);
mm/fadvise.c +1 -1
@@ -49,7 +49,7 @@ asmlinkage long sys_fadvise64_64(int fd, goto out; } -if (mapping->a_ops->get_xip_page) { +if (mapping->a_ops->get_xip_mem) {switch (advice) {case POSIX_FADV_NORMAL :case POSIX_FADV_RANDOM :
mm/filemap_xip.c +100 -100
357 lines not on this page · raw message
mm/madvise.c +1 -1
@@ -112,7 +112,7 @@ static long madvise_willneed(struct vm_aif (!file)return -EBADF ; -if (file->f_mapping->a_ops->get_xip_page) { +if (file->f_mapping->a_ops->get_xip_mem) {/* no bad return value, but ignore advice */ return 0 ; }
PATCH 6/7 s390: implement pte special bit
In reply to [email protected]From: Carsten Otte <[email protected]>
Implement pte_special pte bit for s390. s390 has trouble making pfn_valid do exactly what we'd like for VM_MIXEDMAP, because it has a very dynamic memory model, and it would have to take a semaphore and walk a list for each pfn_valid call. Use pte_special instead which is just a single bit test.
--- include/asm-s390/pgtable.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/asm-s390/pgtable.h +4 -1
@@ -219,6 +219,8 @@ extern char empty_zero_page[PAGE_SIZE];/* Software bits in the page table entry */ #define _PAGE_SWT 0x001/* SW pte type bit t */ #define _PAGE_SWX 0x002/* SW pte type bit x */ +#define _PAGE_SPECIAL 0x004/* SW associated with special page */ +#define __HAVE_ARCH_PTE_SPECIAL/* Six different types of pages. */ #define _PAGE_TYPE_EMPTY 0x400
@@ -512,7 +514,7 @@ static inline int pte_file(pte_t pte)static inline int pte_special (pte_t pte) { -return 0 ; +return (pte_val (pte) & _PAGE_SPECIAL); }#define __HAVE_ARCH_PTE_SAME
@@ -670,6 +672,7 @@ static inline pte_t pte_mkyoung(pte_t ptstatic inline pte_t pte_mkspecial (pte_t pte) { +pte_val (pte) |= _PAGE_SPECIAL;return pte; }
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 7/7 s390: remove struct page entries for DCSS memory segments
In reply to [email protected]This patch removes struct page entries for DCSS segments that are being loaded. They can still be accessed correctly, thanks to the struct page-less XIP work of previous patches.
--- arch/s390/mm/vmem.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
arch/s390/mm/vmem.c +1 -17
@@ -323,8 +323,6 @@ out:int add_shared_memory (unsigned long start,unsigned long size) {struct memory_segment *seg; -struct page *page; -unsigned long pfn, num_pfn, end_pfn;int ret;mutex_lock (&vmem_mutex);
@@ -339,24 +337,10 @@ int add_shared_memory(unsigned long starif (ret) goto out_free; - ret =vmem_add_mem (start, size); + ret =vmem_add_range (start, size);if (ret) goto out_remove; - pfn =PFN_DOWN (start); - num_pfn =PFN_DOWN (size); - end_pfn = pfn + num_pfn; - - page =pfn_to_page (pfn); -memset (page,0 , num_pfn *sizeof (struct page )); - -for (; pfn < end_pfn; pfn++) { - page =pfn_to_page (pfn); -init_page_count (page); -reset_page_mapcount (page); -SetPageReserved (page); -INIT_LIST_HEAD (&page->lru); - } goto out; out_remove:
Signature · 5 lines
-- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>