pram: persistent over-kexec memory file system
Subsystems (6)
RFC PATCH 1/1 pram: persistent over-kexec memory file system
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing and then restoring the processes in the newly booted kernel.
A typical usage scenario would look like this:
1) Boot kernel with 'pram_banned=MEMRANGE' boot option (MEMRANGE=MEMMIN-MEMMAX).
This is to prevent kexec from overwriting persistent data while loading the new kernel. Later on kexec will be forced to load kernel to the range specified. MEMRANGE=0-128M should be enough.
2) Mount pram file system and save dump files there:
# mount -t pram none /mnt
# criu dump -D /mnt -t $PID3) Run kexec passing pram location to the new kernel and forcing it to
load the kernel image to MEMRAGE:
# kexec --load /vmlinuz --initrd=initrd.img \
--append="$(cat /proc/cmdline | sed -e 's/pram=[^ ]*//g') pram=$(cat /sys/kernel/pram)" \
--mem-min=$MEMMIN --mem-max=$MEMMAX
# reboot4) After reboot mount pram, restore processes, and cleanup:
# mount -t pram none /mnt
# criu restore -d -D /mnt
# rm -f /mnt/*
# umount /mntIn this patch I introduce the pram pseudo file system that keeps its memory in place during kexec. pram is based on ramfs, but it serializes and leaves in memory its content on unmount, and restores it on the next mount. To survive over kexec, pram finds the serialized content, whose location should be specified by 'pram' boot param (exported via /sys/kernel/pram), and reserves it at early boot. To avoid conflicts with other parts of the kernel that make early reservation too, pram tracks all memory regions that have ever been reserved and avoids using them for storing its data. Plus, it adds 'pram_banned' boot param, which can be used to explicitly disallow pram to use specified memory regions. This may be useful for avoiding conflicts with kexec loading the new kernel image (as it is done in the usage scenario).
This implementation serves as a proof of concept and so has a number of limitations:
* pram only supports regular files; directories, symlinks, etc are ignored
* pram is implemented only for x86
* pram does not support swapping out
* pram checksums serialized content and drops it in case it is corrupted with no possibility of restore
What do you think about it, does it make sense to go on with this approach or should we reconsider it as a whole?
Thanks.
--- arch/x86/kernel/setup.c | 2 + fs/Kconfig | 13 + fs/ramfs/Makefile | 1 + fs/ramfs/inode.c | 2 +- fs/ramfs/persistent.c | 699 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/pram.h | 18 ++ include/linux/ramfs.h | 1 + kernel/ksysfs.c | 13 + mm/bootmem.c | 5 + mm/memblock.c | 7 +- mm/nobootmem.c | 2 + mm/page_alloc.c | 3 + 12 files changed, 764 insertions(+), 2 deletions(-) create mode 100644 fs/ramfs/persistent.c create mode 100644 include/linux/pram.h
arch/x86/kernel/setup.c +2 -0
@@ -50,6 +50,7 @@#include <linux/init_ohci1394_dma.h> #include <linux/kvm_para.h> #include <linux/dma-contiguous.h> +#include <linux/pram.h> #include <linux/errno.h> #include <linux/kernel.h>
@@ -1137,6 +1138,7 @@ void __init setup_arch(char **cmdline_p)early_acpi_boot_init ();initmem_init (); +pram_reserve ();memblock_find_dma_reserve ();#ifdef CONFIG_KVM_GUEST
fs/Kconfig +13 -0
@@ -168,6 +168,19 @@ config HUGETLB_PAGE source "fs/configfs/Kconfig" +config PRAM + bool "Persistent over-kexec memory storage" + depends on X86 + select CRC32 + select LIBCRC32C + select CRYPTO_CRC32C + select CRYPTO_CRC32C_INTEL + default n + help + pram is a filesystem that saves its content on unmount to be restored + on the next mount after kexec. It can be used for speeding up system + reboot by saving application memory images there. + endmenu menuconfig MISC_FILESYSTEMS
fs/ramfs/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-y += ramfs.o file-mmu-y := file-nommu.o file-mmu-$(CONFIG_MMU) := file-mmu.o ramfs-objs += inode.o $(file-mmu-y) +ramfs-$(CONFIG_PRAM) += persistent.o
fs/ramfs/inode.c +1 -1
@@ -250,7 +250,7 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type,return mount_nodev (fs_type, flags|MS_NOUSER , data, ramfs_fill_super); } -static void ramfs_kill_sb (struct super_block *sb) +void ramfs_kill_sb (struct super_block *sb) {kfree (sb->s_fs_info);kill_litter_super (sb);
fs/ramfs/persistent.c new file +699 -0
699 lines not on this page · raw message
include/linux/pram.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef _LINUX_PRAM_H +#define _LINUX_PRAM_H + +extern unsigned long pram_pfn; + +#ifdef CONFIG_PRAM +extern unsigned long pram_reserved_pages; +extern void pram_reserve (void ); +extern void pram_ban_region (unsigned long start,unsigned long end); +extern void pram_show_banned (void ); +#else +#define pram_reserved_pages 0UL +static inline void pram_reserve (void ) { } +static inline void pram_ban_region (unsigned long start,unsigned long end) { } +static inline void pram_show_banned (void ) { } +#endif + +#endif
include/linux/ramfs.h +1 -0
@@ -5,6 +5,7 @@ struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir, umode_t mode, dev_t dev);extern struct dentry *ramfs_mount (struct file_system_type *fs_type,int flags,const char *dev_name,void *data); +extern void ramfs_kill_sb (struct super_block *sb);#ifdef CONFIG_MMU static inline int
kernel/ksysfs.c +13 -0
@@ -18,6 +18,7 @@#include <linux/stat.h> #include <linux/sched.h> #include <linux/capability.h> +#include <linux/pram.h> #define KERNEL_ATTR_RO (_name) \ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
@@ -132,6 +133,15 @@ KERNEL_ATTR_RO(vmcoreinfo);#endif /* CONFIG_KEXEC */ +#ifdef CONFIG_KEXEC +static ssize_t pram_show (struct kobject *kobj, +struct kobj_attribute *attr,char *buf) +{ +return sprintf (buf,"%lx\n" , pram_pfn); +} +KERNEL_ATTR_RO (pram); +#endif +/* whether file capabilities are enabled */ static ssize_t fscaps_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf)
@@ -196,6 +206,9 @@ static struct attribute * kernel_attrs[] = { &kexec_crash_size_attr.attr, &vmcoreinfo_attr.attr, #endif +#ifdef CONFIG_PRAM + &pram_attr.attr, +#endif &rcu_expedited_attr.attr,NULL };
mm/bootmem.c +5 -0
@@ -16,6 +16,7 @@#include <linux/kmemleak.h> #include <linux/range.h> #include <linux/memblock.h> +#include <linux/pram.h> #include <asm/bug.h> #include <asm/io.h>
@@ -279,6 +280,7 @@ unsigned long __init free_all_bootmem(void) total_pages +=free_all_bootmem_core (bdata); totalram_pages += total_pages; + totalram_pages += pram_reserved_pages;return total_pages; }
@@ -321,6 +323,9 @@ static int __init __reserve(bootmem_data_t *bdata, unsigned long sidx,bdebug ("silent double reserve of PFN %lx\n" , idx + bdata->node_min_pfn); } + +pram_ban_region (sidx + bdata->node_min_pfn, + eidx + bdata->node_min_pfn -1 );return 0 ; }
mm/memblock.c +6 -1
@@ -19,6 +19,7 @@#include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/memblock.h> +#include <linux/pram.h> static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
@@ -554,13 +555,17 @@ int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size) {struct memblock_type *_rgn = &memblock.reserved; +int err;memblock_dbg ("memblock_reserve: [%#016llx-%#016llx] %pF\n" , (unsigned long long )base, (unsigned long long )base + size, (void *)_RET_IP_); -return memblock_add_region (_rgn, base, size,MAX_NUMNODES ); + err =memblock_add_region (_rgn, base, size,MAX_NUMNODES ); +if (!err) +pram_ban_region (PFN_DOWN (base),PFN_UP (base + size) -1 ); +return err; }/**
mm/nobootmem.c +2 -0
@@ -16,6 +16,7 @@#include <linux/kmemleak.h> #include <linux/range.h> #include <linux/memblock.h> +#include <linux/pram.h> #include <asm/bug.h> #include <asm/io.h>
@@ -176,6 +177,7 @@ unsigned long __init free_all_bootmem(void)*/ pages =free_low_memory_core_early (); totalram_pages += pages; + totalram_pages += pram_reserved_pages;return pages; }
mm/page_alloc.c +3 -0
@@ -60,6 +60,7 @@#include <linux/page-debug-flags.h> #include <linux/hugetlb.h> #include <linux/sched/rt.h> +#include <linux/pram.h> #include <asm/sections.h> #include <asm/tlbflush.h>
@@ -5313,6 +5314,8 @@ void __init mem_init_print_info(const char *str) totalhigh_pages << (PAGE_SHIFT -10 ), #endif str ? ", " : "", str ? str : ""); + + pram_show_banned(); }/**
Signature · 7 lines
1.7.10.4 -- 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>
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 7 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing and then restoring the processes in the newly booted kernel.
http://pramfs.sourceforge.net/
Marco
--
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>
Quoted 16 lines · Marco Stornelli
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 7 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing and then restoring the processes in the newly booted kernel.
Quoted 1 line
AFAIU it's a bit different thing: PRAMFS as well as pstore, which has already been merged, requires hardware support for over-reboot persistency, so called non-volatile RAM, i.e. RAM which is not directly accessible and so is not used by the kernel. On the contrary, what we'd like to have is preserving usual RAM on kexec. It is possible, because RAM is not reset during kexec. This would allow leaving applications working set as well as filesystem caches in place, speeding the reboot process as a whole and reducing the downtime significantly.
Thanks.
--
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>
Il 27/07/2013 19:35, Vladimir Davydov ha scritto:
Quoted 28 lines · Marco Stornelli
Quoted 16 lines
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 7 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing and then restoring the processes in the newly booted kernel.
Quoted 1 line
AFAIU it's a bit different thing: PRAMFS as well as pstore, which has already been merged, requires hardware support for over-reboot persistency, so called non-volatile RAM, i.e. RAM which is not directly accessible and so is not used by the kernel. On the contrary, what we'd like to have is preserving usual RAM on kexec. It is possible, because RAM is not reset during kexec. This would allow leaving applications working set as well as filesystem caches in place, speeding the reboot process as a whole and reducing the downtime significantly.
Quoted 1 line
Thanks.
Actually not. You can use normal system RAM reserved at boot with mem parameter without any kernel change. Until an hard reset happens, that area will be "persistent".
Regards,
Marco
--
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>
Quoted 29 lines · Marco Stornelli
Il 27/07/2013 19:35, Vladimir Davydov ha scritto:
Quoted 28 lines · Marco Stornelli
Quoted 16 lines
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 7 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing and then restoring the processes in the newly booted kernel.
Quoted 1 line
AFAIU it's a bit different thing: PRAMFS as well as pstore, which has already been merged, requires hardware support for over-reboot persistency, so called non-volatile RAM, i.e. RAM which is not directly accessible and so is not used by the kernel. On the contrary, what we'd like to have is preserving usual RAM on kexec. It is possible, because RAM is not reset during kexec. This would allow leaving applications working set as well as filesystem caches in place, speeding the reboot process as a whole and reducing the downtime significantly.
Quoted 3 lines
Quoted 1 line
Thanks.
Actually not. You can use normal system RAM reserved at boot with mem parameter without any kernel change. Until an hard reset happens, that area will be "persistent".
Thank you, we'll look at PRAMFS closer, but right now, after trying it I have a couple of concerns I'd appreciate if you could clarify:
1) As you advised, I tried to reserve a range of memory (passing memmap=4G$4G at boot) and mounted PRAMFS using the following options:
# mount -t pramfs -o physaddr=0x100000000,init=4G,bs=4096 none /mnt/pramfs
And it turned out that PRAMFS is very slow as compared to ramfs:
# dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 9.23498 s, 45.4 MB/s # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] conv=notrunc 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 3.04692 s, 138 MB/s
We need it to be as fast as usual RAM, because otherwise the benefit of it over hdd disappears. So before diving into the code, I'd like to ask you if it's intrinsic to PRAMFS, or can it be fixed? Or, perhaps, I used wrong mount/boot/config options (btw, I enabled only CONFIG_PRAMFS)?
2) To enable saving application dump files in memory using PRAMFS, one should reserve half of RAM for it. That's too expensive. While with ramfs, once SPLICE_F_MOVE flag is implemented, one could move anonymous memory pages to ramfs page cache and after kexec move it back so that almost no extra memory space costs would be required. Of course, SPLICE_F_MOVE is to be yet implemented, but with PRAMFS significant memory costs are inevitable... or am I wrong?
Thanks.
--
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>
Il 28/07/2013 12:05, Vladimir Davydov ha scritto:
Quoted 58 lines · Marco Stornelli
Quoted 30 lines
Il 27/07/2013 19:35, Vladimir Davydov ha scritto:
Quoted 29 lines · Marco Stornelli
Quoted 17 lines
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 8 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing
and then restoring the processes in the newly booted kernel.Quoted 1 line
AFAIU it's a bit different thing: PRAMFS as well as pstore, which has already been merged, requires hardware support for over-reboot persistency, so called non-volatile RAM, i.e. RAM which is not directly accessible and so is not used by the kernel. On the contrary, what we'd like to have is preserving usual RAM on kexec. It is possible, because RAM is not reset during kexec. This would allow leaving applications working set as well as filesystem caches in place, speeding the reboot process as a whole and reducing the downtime significantly.
Quoted 5 lines
Quoted 1 line
Thanks.
Actually not. You can use normal system RAM reserved at boot with mem parameter without any kernel change. Until an hard reset happens, that area will be "persistent".
Thank you, we'll look at PRAMFS closer, but right now, after trying it I have a couple of concerns I'd appreciate if you could clarify:
1) As you advised, I tried to reserve a range of memory (passing memmap=4G$4G at boot) and mounted PRAMFS using the following options:
# mount -t pramfs -o physaddr=0x100000000,init=4G,bs=4096 none /mnt/pramfsAnd it turned out that PRAMFS is very slow as compared to ramfs:
# dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 9.23498 s, 45.4 MB/s # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] conv=notrunc 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 3.04692 s, 138 MB/s
Quoted 5 lines
We need it to be as fast as usual RAM, because otherwise the benefit of it over hdd disappears. So before diving into the code, I'd like to ask you if it's intrinsic to PRAMFS, or can it be fixed? Or, perhaps, I used wrong mount/boot/config options (btw, I enabled only
CONFIG_PRAMFS)?
In x86 you should have the write protection enabled. Turn it off or mount it with noprotect option.
Quoted 9 lines
2) To enable saving application dump files in memory using PRAMFS, one should reserve half of RAM for it. That's too expensive. While with ramfs, once
SPLICE_F_MOVEflag is implemented, one could move anonymous memory pages to ramfs page cache and after kexec move it back so that almost no extra memory space costs would be required. Of course,SPLICE_F_MOVEis to be yet implemented, but with PRAMFS significant memory costs are inevitable... or am I wrong?Thanks.
From this point of view you are right. Pramfs (or other solution like that) are out of page cache, so you can't do any memory transfer. It's like to have a disk but it's actually a separate piece of RAM. We could talk about it again when this kind of implementation will be done.
Marco
--
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>
Quoted 59 lines · Marco Stornelli
Il 28/07/2013 12:05, Vladimir Davydov ha scritto:
Quoted 58 lines · Marco Stornelli
Quoted 30 lines
Il 27/07/2013 19:35, Vladimir Davydov ha scritto:
Quoted 29 lines · Marco Stornelli
Quoted 17 lines
Il 26/07/2013 14:29, Vladimir Davydov ha scritto:
Quoted 7 lines
Hi,
We want to propose a way to upgrade a kernel on a machine without restarting all the user-space services. This is to be done with CRIU project, but we need help from the kernel to preserve some data in memory while doing kexec.
Quoted 8 lines
The key point of our implementation is leaving process memory in-place during reboot. This should eliminate most io operations the services would produce during initialization. To achieve this, we have implemented a pseudo file system that preserves its content during kexec. We propose saving CRIU dump files to this file system, kexec'ing
and then restoring the processes in the newly booted kernel.Quoted 1 line
AFAIU it's a bit different thing: PRAMFS as well as pstore, which has already been merged, requires hardware support for over-reboot persistency, so called non-volatile RAM, i.e. RAM which is not directly accessible and so is not used by the kernel. On the contrary, what we'd like to have is preserving usual RAM on kexec. It is possible, because RAM is not reset during kexec. This would allow leaving applications working set as well as filesystem caches in place, speeding the reboot process as a whole and reducing the downtime significantly.
Quoted 5 lines
Quoted 1 line
Thanks.
Actually not. You can use normal system RAM reserved at boot with mem parameter without any kernel change. Until an hard reset happens, that area will be "persistent".
Thank you, we'll look at PRAMFS closer, but right now, after trying it I have a couple of concerns I'd appreciate if you could clarify:
1) As you advised, I tried to reserve a range of memory (passing memmap=4G$4G at boot) and mounted PRAMFS using the following options:
# mount -t pramfs -o physaddr=0x100000000,init=4G,bs=4096 none /mnt/pramfsAnd it turned out that PRAMFS is very slow as compared to ramfs:
# dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 9.23498 s, 45.4 MB/s # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] conv=notrunc 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 3.04692 s, 138 MB/s
Quoted 7 lines
Quoted 5 lines
We need it to be as fast as usual RAM, because otherwise the benefit of it over hdd disappears. So before diving into the code, I'd like to ask you if it's intrinsic to PRAMFS, or can it be fixed? Or, perhaps, I used wrong mount/boot/config options (btw, I enabled only
CONFIG_PRAMFS)?In x86 you should have the write protection enabled. Turn it off or mount it with noprotect option.
I tried. This helps, but the write rate is still too low:
with write protect:
# mount -t pramfs -o physaddr=0x100000000,init=4G,bs=4096 none /mnt/pramfs # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 17.6007 s, 23.8 MB/s # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] conv=notrunc 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 4.32923 s, 96.9 MB/s
w/o write protect:
# mount -t pramfs -o physaddr=0x100000000,init=4G,bs=4096,noprotect none /mnt/pramfs # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 9.07748 s, 46.2 MB/s # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/pramfs/dummy bs=4096 count=$[100*1024] conv=notrunc 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 3.04596 s, 138 MB/s
Also tried turning off CONFIG_PRAMFS_WRITE_PROTECT, the result is the same: the rate does not exceed 150 MB/s, which is too slow comparing to ramfs:
# mount -t ramfs none /mnt/ramfs # dd if=/dev/zero of=/mnt/pramfs if=/dev/zero of=/mnt/ramfs/dummy bs=4096 count=$[100*1024] 102400+0 records in 102400+0 records out 419430400 bytes (419 MB) copied, 0.200809 s, 2.1 GB/s
Quoted 9 lines
Quoted 9 lines
2) To enable saving application dump files in memory using PRAMFS, one should reserve half of RAM for it. That's too expensive. While with ramfs, once
SPLICE_F_MOVEflag is implemented, one could move anonymous memory pages to ramfs page cache and after kexec move it back so that almost no extra memory space costs would be required. Of course,SPLICE_F_MOVEis to be yet implemented, but with PRAMFS significant memory costs are inevitable... or am I wrong?
Quoted 3 lines
Quoted 1 line
Thanks.
From this point of view you are right. Pramfs (or other solution like that) are out of page cache, so you can't do any memory transfer. It's like to have a disk but it's actually a separate piece of RAM. We could talk about it again when this kind of implementation will be done
Yeah, that's the main difference. PRAMFS lives in a dedicated region, while page cache is spread all over the whole RAM, and what is worse, some pages can be used at early boot.
I believe dealing with page cache could be wired into PRAMFS, but the question is what would be clearer: implement something lightweight and standalone, or blow existing code, which was not initially planned to handle things like that? I will think about that.
Thanks.
--
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>