(take 3) transcendent memory ("tmem") linux-side changes
Subsystems (8)
PATCH 1/1 (take 3) transcendent memory ("tmem") linux-side changes
(take 3: no anonymous unions; match Jan's xen-side patch)
Transcendent memory ("tmem") for Linux
Tmem, when called from a tmem-capable (paravirtualized) guest, makes use of otherwise unutilized ("fallow") memory to create and manage pools of pages that can be accessed from the guest either as "ephemeral" pages or as "persistent" pages. In either case, the pages are not directly addressible by the guest, only copied to and fro via the tmem interface. Ephemeral pages are a nice place for a guest to put recently evicted clean pages that it might need again; these pages can be reclaimed synchronously by Xen for other guests or other uses. Persistent pages are a nice place for a guest to put "swap" pages to avoid sending them to disk. These pages retain data as long as the guest lives, but count against the guest memory allocation.
This patch contains the Linux paravirtualization changes to complement the tmem Xen patch (xen-unstable c/s 19646). It implements "precache" (ext3 only as of now), "preswap", and limited "shared precache" (ocfs2 only as of now) support. CONFIG options are required to turn on
the support (but in this patch they default to "y"). If the underlying Xen does not have tmem support or has it turned off, this is sensed early to avoid nearly all hypercalls.
Lots of useful prose about tmem can be found at
http://oss.oracle.com/projects/tmem
fs/buffer.c +6 -0
@@ -41,6 +41,7 @@#include <linux/bitops.h> #include <linux/mpage.h> #include <linux/bit_spinlock.h> +#include <linux/precache.h> static int fsync_buffers_list (spinlock_t *lock,struct list_head *list);static void invalidate_bh_lrus (void );
@@ -482,6 +483,11 @@ void invalidate_bdev(struct block_device* that, but not until that's cleaned up. */ invalidate_inode_pages (mapping); + +/* 99% of the time, we don't need to flush the precache on the bdev. +* But, for the strange corners, lets be cautious +*/ +precache_flush_inode (mapping); }/*
fs/ext3/super.c +2 -0
@@ -35,6 +35,7 @@#include <linux/namei.h> #include <linux/quotaops.h> #include <linux/seq_file.h> +#include <linux/precache.h> #include <asm/uaccess.h>
@@ -1167,6 +1168,7 @@ static int ext3_setup_super(struct super }else {printk ("internal journal\n" ); } +precache_init (sb);return res; }
fs/mpage.c +8 -0
@@ -26,6 +26,7 @@#include <linux/writeback.h> #include <linux/backing-dev.h> #include <linux/pagevec.h> +#include <linux/precache.h> /* * I/O completion handler for multipage BIOs.
@@ -296,6 +297,13 @@ do_mpage_readpage(struct bio *bio, struc } }else if (fully_mapped) {SetPageMappedToDisk (page); + } + +if (fully_mapped && + blocks_per_page ==1 && !PageUptodate (page) && +precache_get (page->mapping, page->index, page) ==1 ) { +SetPageUptodate (page); + goto confused; }/*
fs/ocfs2/super.c +5 -2
@@ -39,6 +39,7 @@#include <linux/parser.h> #include <linux/crc32.h> #include <linux/debugfs.h> +#include <linux/precache.h> #include <cluster/nodemanager.h>
@@ -1457,16 +1458,18 @@ static int ocfs2_initialize_super(struct di = (struct ocfs2_dinode *) bitmap_bh->b_data; osb->bitmap_cpg =le16_to_cpu (di->id2.i_chain.cl_cpg); -brelse (bitmap_bh);mlog (0 ,"cluster bitmap inode: %llu, clusters per group: %u\n" , (unsigned long long )osb->bitmap_blkno, osb->bitmap_cpg); status =ocfs2_init_slot_info (osb);if (status <0 ) {mlog_errno (status); - goto bail; + goto bail_rel; } +shared_precache_init (sb, &di->id2.i_super.s_uuid[0 ]); +bail_rel: +brelse (bitmap_bh); bail:mlog_exit (status);return status;
fs/super.c +8 -0
@@ -37,6 +37,7 @@#include <linux/idr.h> #include <linux/kobject.h> #include <linux/mutex.h> +#include <linux/precache.h> #include <asm/uaccess.h>
@@ -93,6 +94,9 @@ static struct super_block *alloc_super(s s->s_qcop = sb_quotactl_ops; s->s_op = &default_op; s->s_time_gran =1000000000 ; +#ifdef CONFIG_PRECACHE + s->precache_poolid =-1 ; +#endif } out:return s;
@@ -181,6 +185,7 @@ void deactivate_super(struct super_blockDQUOT_OFF (s);down_write (&s->s_umount); fs->kill_sb (s); +precache_flush_filesystem (s);put_filesystem (fs);put_super (s); }
@@ -777,6 +782,9 @@ int get_sb_nodev(struct file_system_typereturn error; } s->s_flags |=MS_ACTIVE ; +#ifdef CONFIG_PRECACHE + s->precache_poolid =-2 ; +#endif return simple_set_mnt (mnt, s); }
include/asm-i386/mach-xen/asm/hypercall.h +6 -0
@@ -404,6 +404,12 @@ HYPERVISOR_kexec_op( return _hypercall2(int, kexec_op, op, args); } +static inline int __must_check +HYPERVISOR_tmem_op ( +struct tmem_op *op) +{ +return _hypercall1 (int, tmem_op, op); +}#endif /* __HYPERCALL_H__ */
include/asm-x86_64/mach-xen/asm/hypercall.h +7 -0
@@ -405,4 +405,11 @@ HYPERVISOR_kexec_op( return _hypercall2(int, kexec_op, op, args); } +static inline int __must_check +HYPERVISOR_tmem_op ( +struct tmem_op *op) +{ +return _hypercall1 (int, tmem_op, op); +} +#endif /* __HYPERCALL_H__ */
include/linux/fs.h +3 -0
@@ -907,6 +907,9 @@ struct super_block {/* Granularity of c/m/atime in ns. Cannot be worse than a second */ u32 s_time_gran; +#ifdef CONFIG_PRECACHE +u32 precache_poolid; +#endif };extern struct timespec current_fs_time (struct super_block *sb);
include/linux/precache.h new file +55 -0
55 lines not on this page · raw message
include/linux/swap.h +52 -1
73 lines not on this page · raw message
include/linux/sysctl.h +1 -0
@@ -200,6 +200,7 @@ enumVM_PANIC_ON_OOM =33 ,/* panic at out-of-memory */ VM_VDSO_ENABLED =34 ,/* map VDSO into new processes? */ VM_MIN_SLAB =35 ,/* Percent pages ignored by zone reclaim */ + VM_PRESWAP_PAGES=36, /* pages/target_pages in preswap */ };
include/xen/interface/xen.h +25 -0
@@ -91,6 +91,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);#define __HYPERVISOR_sysctl 35#define __HYPERVISOR_domctl 36#define __HYPERVISOR_kexec_op 37 +#define __HYPERVISOR_tmem_op 38/* Architecture-specific hypercall definitions. */ #define __HYPERVISOR_arch_0 48
@@ -324,6 +325,30 @@ DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);#define VMASST_TYPE_pae_extended_cr3 3#define MAX_VMASST_TYPE 3 + +#ifndef __ASSEMBLY__ +struct tmem_op { +uint32_t cmd; +int32_t pool_id;/* private > 0; shared < 0; 0 is invalid */ +union { +struct {/* for cmd == TMEM_NEW_POOL */ +uint64_t uuid[2 ]; +uint32_t flags; + } new; +struct { +uint64_t object; +uint32_t index; +uint32_t tmem_offset; +uint32_t pfn_offset; +uint32_t len; +xen_pfn_t gmfn;/* guest machine page frame */ + } gen; + } u; +}; +typedef struct tmem_op tmem_op_t ; +DEFINE_XEN_GUEST_HANDLE (tmem_op_t); + +#endif #ifndef __ASSEMBLY__
kernel/sysctl.c +12 -0
@@ -965,6 +965,18 @@ static ctl_table vm_table[] = { .proc_handler = &proc_dointvec, .strategy = &sysctl_intvec, .extra1 = &zero, + }, +#endif +#ifdef CONFIG_PRESWAP + { + .ctl_name = VM_PRESWAP_PAGES, + .procname = "preswap", + .data = NULL, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = &preswap_sysctl_handler, + .extra1 = (void *)&preswap_zero, + .extra2 = (void *)&preswap_infinity, }, #endif { .ctl_name = 0 }
mm/Kconfig +30 -0
@@ -152,3 +152,33 @@ config RESOURCES_64BIT default 64BIT help This option allows memory and IO resources to be 64 bit. + +# +# support for transcendent memory +# +config TMEM + bool + depends on XEN + help + In a virtualized environment, allows unused and underutilized + system physical memory to be made accessible through a narrow + well-defined page-copy-based API. If unsure, say Y. + +config PRECACHE + bool "Cache clean pages in transcendent memory" + depends on XEN + select TMEM + help + Allows the transcendent memory pool to be used to store clean + page-cache pages which, under some circumstances, will greatly + reduce paging and thus improve performance. If unsure, say Y. + +config PRESWAP + bool "Swap pages to transcendent memory" + depends on XEN + select TMEM + help + Allows the transcendent memory pool to be used as a pseudo-swap + device which, under some circumstances, will greatly reduce + swapping and thus improve performance. If unsure, say Y. +
mm/Makefile +3 -0
@@ -13,6 +13,9 @@ obj-y := bootmem.o filemap.o mempool.o prio_tree.o util.o mmzone.o vmstat.o $(mmu-y) obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o +obj-$(CONFIG_TMEM) += tmem.o +obj-$(CONFIG_PRESWAP) += preswap.o +obj-$(CONFIG_PRECACHE) += precache.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_NUMA) += mempolicy.o obj-$(CONFIG_SPARSEMEM) += sparse.o
mm/filemap.c +11 -0
@@ -30,6 +30,7 @@#include <linux/security.h> #include <linux/syscalls.h> #include <linux/cpuset.h> +#include <linux/precache.h> #include "filemap.h" #include "internal.h"
@@ -115,6 +116,16 @@ void __remove_from_page_cache(struct pagvoid __remove_from_page_cache (struct page *page) {struct address_space *mapping = page->mapping; + +/* +* if we're uptodate, flush out into the precache, otherwise +* invalidate any existing precache entries. We can't leave +* stale data around in the precache once our page is gone +*/ +if (PageUptodate (page)) +precache_put (page->mapping, page->index, page); +else +precache_flush (page->mapping, page->index);radix_tree_delete (&mapping->page_tree, page->index); page->mapping =NULL ;
mm/page_io.c +16 -1
@@ -99,10 +99,18 @@ int swap_writepage(struct page *page, st ret = -ENOMEM ; goto out; } + +set_page_writeback (page); +if (preswap_put (page) ==1 ) { +unlock_page (page); +end_page_writeback (page); +bio_put (bio); + goto out; + } +if (wbc->sync_mode ==WB_SYNC_ALL ) rw |= (1 <<BIO_RW_SYNC );count_vm_event (PSWPOUT ); -set_page_writeback (page);unlock_page (page);submit_bio (rw, bio); out:
@@ -116,6 +124,13 @@ int swap_readpage(struct file *file, strBUG_ON (!PageLocked (page));ClearPageUptodate (page); + +if (preswap_get (page) ==1 ) { +SetPageUptodate (page); +unlock_page (page); + goto out; + } + bio =get_swap_bio (GFP_KERNEL ,page_private (page), page, end_swap_bio_read);if (bio ==NULL ) {
mm/precache.c new file +140 -0
140 lines not on this page · raw message
mm/preswap.c new file +184 -0
184 lines not on this page · raw message
mm/swapfile.c +122 -4
205 lines not on this page · raw message
mm/tmem.c new file +41 -0
41 lines not on this page · raw message
mm/tmem.h new file +115 -0
115 lines not on this page · raw message
mm/truncate.c +10 -1
@@ -12,13 +12,14 @@#include <linux/module.h> #include <linux/pagemap.h> #include <linux/pagevec.h> +#include <linux/precache.h> #include <linux/buffer_head.h> /* grr. try_to_release_page, do_invalidatepage */ -static inline void truncate_partial_page (struct page *page,unsigned partial) {memclear_highpage_flush (page, partial,PAGE_CACHE_SIZE -partial); +precache_flush (page->mapping, page->index);if (PagePrivate (page))do_invalidatepage (page, partial); }
@@ -46,6 +47,10 @@ truncate_complete_page(struct address_spClearPageUptodate (page);ClearPageMappedToDisk (page);remove_from_page_cache (page); +/* this must be after the remove_from_page_cache which +* calls precache_put +*/ +precache_flush (mapping, page->index);page_cache_release (page);/* pagecache ref */ }
@@ -118,6 +123,7 @@ void truncate_inode_pages_range(struct apgoff_t next;int i; +precache_flush_inode (mapping);if (mapping->nrpages ==0 )return ;
@@ -191,6 +197,7 @@ void truncate_inode_pages_range(struct a }pagevec_release (&pvec); } +precache_flush_inode (mapping); }EXPORT_SYMBOL (truncate_inode_pages_range);
@@ -324,6 +331,7 @@ int invalidate_inode_pages2_range(structint did_range_unmap =0 ;int wrapped =0 ; +precache_flush_inode (mapping);pagevec_init (&pvec,0 ); next = start; while (next <= end && !ret && !wrapped &&
@@ -379,6 +387,7 @@ int invalidate_inode_pages2_range(structpagevec_release (&pvec);cond_resched (); } +precache_flush_inode (mapping);return ret; }EXPORT_SYMBOL_GPL (invalidate_inode_pages2_range);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · Dan Magenheimer
(take 3: no anonymous unions; match Jan's xen-side patch)
Transcendent memory ("tmem") for Linux
I've now synced the Xen headers over to Linux 2.6.18, so please rebase the patch on that. This means you will not need to modify anything under include/xen/interface, and probably most of mm/tmem.h goes as well.
-- Keir
Attached rebased against 906 in the staging tree.
Quoted 14 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Wednesday, June 17, 2009 12:32 AM
To: Dan Magenheimer; Xen-Devel (E-mail)
Cc: Jan Beulich
Subject: Re: [Xen-devel] [PATCH] [linux-2.6.18-xen] (take 3) transcendent memory ("tmem") linux-side changesQuoted 2 lines · Dan Magenheimer
(take 3: no anonymous unions; match Jan's xen-side patch)
Quoted 11 lines
Quoted 1 line
Transcendent memory ("tmem") for Linux
I've now synced the Xen headers over to Linux 2.6.18, so please rebase the
patch on that. This means you will not need to modify anything underinclude/xen/interface, and probably most ofmm/tmem.hgoes as well.-- Keir
fs/buffer.c +6 -0
@@ -41,6 +41,7 @@#include <linux/bitops.h> #include <linux/mpage.h> #include <linux/bit_spinlock.h> +#include <linux/precache.h> static int fsync_buffers_list (spinlock_t *lock,struct list_head *list);static void invalidate_bh_lrus (void );
@@ -482,6 +483,11 @@ void invalidate_bdev(struct block_device* that, but not until that's cleaned up. */ invalidate_inode_pages (mapping); + +/* 99% of the time, we don't need to flush the precache on the bdev. +* But, for the strange corners, lets be cautious +*/ +precache_flush_inode (mapping); }/*
fs/ext3/super.c +2 -0
@@ -35,6 +35,7 @@#include <linux/namei.h> #include <linux/quotaops.h> #include <linux/seq_file.h> +#include <linux/precache.h> #include <asm/uaccess.h>
@@ -1167,6 +1168,7 @@ static int ext3_setup_super(struct super }else {printk ("internal journal\n" ); } +precache_init (sb);return res; }
fs/mpage.c +8 -0
@@ -26,6 +26,7 @@#include <linux/writeback.h> #include <linux/backing-dev.h> #include <linux/pagevec.h> +#include <linux/precache.h> /* * I/O completion handler for multipage BIOs.
@@ -296,6 +297,13 @@ do_mpage_readpage(struct bio *bio, struc } }else if (fully_mapped) {SetPageMappedToDisk (page); + } + +if (fully_mapped && + blocks_per_page ==1 && !PageUptodate (page) && +precache_get (page->mapping, page->index, page) ==1 ) { +SetPageUptodate (page); + goto confused; }/*
fs/ocfs2/super.c +5 -2
@@ -39,6 +39,7 @@#include <linux/parser.h> #include <linux/crc32.h> #include <linux/debugfs.h> +#include <linux/precache.h> #include <cluster/nodemanager.h>
@@ -1457,16 +1458,18 @@ static int ocfs2_initialize_super(struct di = (struct ocfs2_dinode *) bitmap_bh->b_data; osb->bitmap_cpg =le16_to_cpu (di->id2.i_chain.cl_cpg); -brelse (bitmap_bh);mlog (0 ,"cluster bitmap inode: %llu, clusters per group: %u\n" , (unsigned long long )osb->bitmap_blkno, osb->bitmap_cpg); status =ocfs2_init_slot_info (osb);if (status <0 ) {mlog_errno (status); - goto bail; + goto bail_rel; } +shared_precache_init (sb, &di->id2.i_super.s_uuid[0 ]); +bail_rel: +brelse (bitmap_bh); bail:mlog_exit (status);return status;
fs/super.c +8 -0
@@ -37,6 +37,7 @@#include <linux/idr.h> #include <linux/kobject.h> #include <linux/mutex.h> +#include <linux/precache.h> #include <asm/uaccess.h>
@@ -93,6 +94,9 @@ static struct super_block *alloc_super(s s->s_qcop = sb_quotactl_ops; s->s_op = &default_op; s->s_time_gran =1000000000 ; +#ifdef CONFIG_PRECACHE + s->precache_poolid =-1 ; +#endif } out:return s;
@@ -181,6 +185,7 @@ void deactivate_super(struct super_blockDQUOT_OFF (s);down_write (&s->s_umount); fs->kill_sb (s); +precache_flush_filesystem (s);put_filesystem (fs);put_super (s); }
@@ -777,6 +782,9 @@ int get_sb_nodev(struct file_system_typereturn error; } s->s_flags |=MS_ACTIVE ; +#ifdef CONFIG_PRECACHE + s->precache_poolid =-2 ; +#endif return simple_set_mnt (mnt, s); }
include/asm-i386/mach-xen/asm/hypercall.h +6 -0
@@ -404,6 +404,12 @@ HYPERVISOR_kexec_op( return _hypercall2(int, kexec_op, op, args); } +static inline int __must_check +HYPERVISOR_tmem_op ( +struct tmem_op *op) +{ +return _hypercall1 (int, tmem_op, op); +}#endif /* __HYPERCALL_H__ */
include/asm-i386/mach-xen/asm/hypervisor.h +1 -0
@@ -43,6 +43,7 @@#include <xen/interface/physdev.h> #include <xen/interface/sched.h> #include <xen/interface/nmi.h> +#include <xen/interface/tmem.h> #include <asm/ptrace.h> #include <asm/page.h> #if defined(__i386__)
include/asm-x86_64/mach-xen/asm/hypercall.h +7 -0
@@ -412,4 +412,11 @@ HYPERVISOR_kexec_op( return _hypercall2(int, kexec_op, op, args); } +static inline int __must_check +HYPERVISOR_tmem_op ( +struct tmem_op *op) +{ +return _hypercall1 (int, tmem_op, op); +} +#endif /* __HYPERCALL_H__ */
include/linux/fs.h +3 -0
@@ -907,6 +907,9 @@ struct super_block {/* Granularity of c/m/atime in ns. Cannot be worse than a second */ u32 s_time_gran; +#ifdef CONFIG_PRECACHE +u32 precache_poolid; +#endif };extern struct timespec current_fs_time (struct super_block *sb);
include/linux/precache.h new file +55 -0
55 lines not on this page · raw message
include/linux/swap.h +52 -1
73 lines not on this page · raw message
include/linux/sysctl.h +1 -0
@@ -200,6 +200,7 @@ enumVM_PANIC_ON_OOM =33 ,/* panic at out-of-memory */ VM_VDSO_ENABLED =34 ,/* map VDSO into new processes? */ VM_MIN_SLAB =35 ,/* Percent pages ignored by zone reclaim */ + VM_PRESWAP_PAGES=36, /* pages/target_pages in preswap */ };
kernel/sysctl.c +12 -0
@@ -965,6 +965,18 @@ static ctl_table vm_table[] = { .proc_handler = &proc_dointvec, .strategy = &sysctl_intvec, .extra1 = &zero, + }, +#endif +#ifdef CONFIG_PRESWAP + { + .ctl_name = VM_PRESWAP_PAGES, + .procname = "preswap", + .data = NULL, + .maxlen = sizeof(unsigned long), + .mode = 0644, + .proc_handler = &preswap_sysctl_handler, + .extra1 = (void *)&preswap_zero, + .extra2 = (void *)&preswap_infinity, }, #endif { .ctl_name = 0 }
mm/Kconfig +30 -0
@@ -152,3 +152,33 @@ config RESOURCES_64BIT default 64BIT help This option allows memory and IO resources to be 64 bit. + +# +# support for transcendent memory +# +config TMEM + bool + depends on XEN + help + In a virtualized environment, allows unused and underutilized + system physical memory to be made accessible through a narrow + well-defined page-copy-based API. If unsure, say Y. + +config PRECACHE + bool "Cache clean pages in transcendent memory" + depends on XEN + select TMEM + help + Allows the transcendent memory pool to be used to store clean + page-cache pages which, under some circumstances, will greatly + reduce paging and thus improve performance. If unsure, say Y. + +config PRESWAP + bool "Swap pages to transcendent memory" + depends on XEN + select TMEM + help + Allows the transcendent memory pool to be used as a pseudo-swap + device which, under some circumstances, will greatly reduce + swapping and thus improve performance. If unsure, say Y. +
mm/Makefile +3 -0
@@ -13,6 +13,9 @@ obj-y := bootmem.o filemap.o mempool.o prio_tree.o util.o mmzone.o vmstat.o $(mmu-y) obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o +obj-$(CONFIG_TMEM) += tmem.o +obj-$(CONFIG_PRESWAP) += preswap.o +obj-$(CONFIG_PRECACHE) += precache.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_NUMA) += mempolicy.o obj-$(CONFIG_SPARSEMEM) += sparse.o
mm/filemap.c +11 -0
@@ -30,6 +30,7 @@#include <linux/security.h> #include <linux/syscalls.h> #include <linux/cpuset.h> +#include <linux/precache.h> #include "filemap.h" #include "internal.h"
@@ -115,6 +116,16 @@ void __remove_from_page_cache(struct pagvoid __remove_from_page_cache (struct page *page) {struct address_space *mapping = page->mapping; + +/* +* if we're uptodate, flush out into the precache, otherwise +* invalidate any existing precache entries. We can't leave +* stale data around in the precache once our page is gone +*/ +if (PageUptodate (page)) +precache_put (page->mapping, page->index, page); +else +precache_flush (page->mapping, page->index);radix_tree_delete (&mapping->page_tree, page->index); page->mapping =NULL ;
mm/page_io.c +16 -1
@@ -99,10 +99,18 @@ int swap_writepage(struct page *page, st ret = -ENOMEM ; goto out; } + +set_page_writeback (page); +if (preswap_put (page) ==1 ) { +unlock_page (page); +end_page_writeback (page); +bio_put (bio); + goto out; + } +if (wbc->sync_mode ==WB_SYNC_ALL ) rw |= (1 <<BIO_RW_SYNC );count_vm_event (PSWPOUT ); -set_page_writeback (page);unlock_page (page);submit_bio (rw, bio); out:
@@ -116,6 +124,13 @@ int swap_readpage(struct file *file, strBUG_ON (!PageLocked (page));ClearPageUptodate (page); + +if (preswap_get (page) ==1 ) { +SetPageUptodate (page); +unlock_page (page); + goto out; + } + bio =get_swap_bio (GFP_KERNEL ,page_private (page), page, end_swap_bio_read);if (bio ==NULL ) {
mm/precache.c new file +140 -0
140 lines not on this page · raw message
mm/preswap.c new file +184 -0
184 lines not on this page · raw message
mm/swapfile.c +122 -4
205 lines not on this page · raw message
mm/tmem.c new file +41 -0
41 lines not on this page · raw message
mm/tmem.h new file +84 -0
84 lines not on this page · raw message
mm/truncate.c +10 -1
@@ -12,13 +12,14 @@#include <linux/module.h> #include <linux/pagemap.h> #include <linux/pagevec.h> +#include <linux/precache.h> #include <linux/buffer_head.h> /* grr. try_to_release_page, do_invalidatepage */ -static inline void truncate_partial_page (struct page *page,unsigned partial) {memclear_highpage_flush (page, partial,PAGE_CACHE_SIZE -partial); +precache_flush (page->mapping, page->index);if (PagePrivate (page))do_invalidatepage (page, partial); }
@@ -46,6 +47,10 @@ truncate_complete_page(struct address_spClearPageUptodate (page);ClearPageMappedToDisk (page);remove_from_page_cache (page); +/* this must be after the remove_from_page_cache which +* calls precache_put +*/ +precache_flush (mapping, page->index);page_cache_release (page);/* pagecache ref */ }
@@ -118,6 +123,7 @@ void truncate_inode_pages_range(struct apgoff_t next;int i; +precache_flush_inode (mapping);if (mapping->nrpages ==0 )return ;
@@ -191,6 +197,7 @@ void truncate_inode_pages_range(struct a }pagevec_release (&pvec); } +precache_flush_inode (mapping); }EXPORT_SYMBOL (truncate_inode_pages_range);
@@ -324,6 +331,7 @@ int invalidate_inode_pages2_range(structint did_range_unmap =0 ;int wrapped =0 ; +precache_flush_inode (mapping);pagevec_init (&pvec,0 ); next = start; while (next <= end && !ret && !wrapped &&
@@ -379,6 +387,7 @@ int invalidate_inode_pages2_range(structpagevec_release (&pvec);cond_resched (); } +precache_flush_inode (mapping);return ret; }EXPORT_SYMBOL_GPL (invalidate_inode_pages2_range);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel