Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-14 Thread anthony . yznaga
On 11/10/2018 08:44 AM, Andrea Arcangeli wrote: > On Sat, Nov 10, 2018 at 01:22:49PM +, Mel Gorman wrote: >> On Fri, Nov 09, 2018 at 02:51:50PM -0500, Andrea Arcangeli wrote: >>> And if you're in the camp that is concerned about the use of more RAM >>> or/and about the higher latency of COW

[PATCH] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-04 Thread Anthony Yznaga
Certain pages that are never mapped to userspace have a type indicated in the page_type field of their struct pages (e.g. PG_buddy). page_type overlaps with _mapcount so set the count to 0 and avoid calling page_mapcount() for these pages. Signed-off-by: Anthony Yznaga --- fs/proc/page.c

[PATCH] tools/vm/page-types.c: fix "kpagecount returned fewer pages than expected" failures

2018-12-04 Thread Anthony Yznaga
Because kpagecount_read() fakes success if map counts are not being collected, clamp the page count passed to it by walk_pfn() to the pages value returned by the preceding call to kpageflags_read(). Fixes: 7f1d23e60718 ("tools/vm/page-types.c: include shared map counts") Signed-off-b

Re: [PATCH] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-04 Thread anthony . yznaga
On 12/04/2018 04:48 PM, Matthew Wilcox wrote: > On Tue, Dec 04, 2018 at 02:45:26PM -0800, Anthony Yznaga wrote: >> Certain pages that are never mapped to userspace have a type >> indicated in the page_type field of their struct pages (e.g. PG_buddy). >> page_type overlaps

Re: [PATCH] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-05 Thread Anthony Yznaga
On 12/04/2018 05:25 PM, Matthew Wilcox wrote: > On Tue, Dec 04, 2018 at 05:18:32PM -0800, anthony.yzn...@oracle.com wrote: >> On 12/04/2018 04:48 PM, Matthew Wilcox wrote: >>> On Tue, Dec 04, 2018 at 02:45:26PM -0800, Anthony Yznaga wrote: >>>> +static inline int p

Re: [PATCH] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-05 Thread Anthony Yznaga
On 12/05/2018 11:44 AM, Matthew Wilcox wrote: > On Wed, Dec 05, 2018 at 11:40:51AM -0800, Anthony Yznaga wrote: >> On 12/04/2018 05:25 PM, Matthew Wilcox wrote: >>> On Tue, Dec 04, 2018 at 05:18:32PM -0800, anthony.yzn...@oracle.com wrote: >>>> On 12/04/2018

Re: [PATCH] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-05 Thread Anthony Yznaga
On 12/05/2018 08:26 PM, Matthew Wilcox wrote: > On Wed, Dec 05, 2018 at 04:44:15PM -0800, Anthony Yznaga wrote: >> On 12/05/2018 11:44 AM, Matthew Wilcox wrote: >>> Nobody seems terribly interested in mapcount overflows. I got no response >>> to https://lkml.or

[RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-08 Thread Anthony Yznaga
ted to a huge page, the unused pages are not charged to a memcg. - Minor code duplication to support mremap. Other TBD: - Performance testing - shmem support - Investigate promoting a reservation synchronously during fault handling rather than waiting for khugepaged to do the promotion. Signed-

Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-09 Thread anthony . yznaga
On 11/09/2018 03:07 AM, Mel Gorman wrote: > On Thu, Nov 08, 2018 at 10:48:58PM -0800, Anthony Yznaga wrote: >> The basic idea as outlined by Mel Gorman in [2] is: >> >> 1) On first fault in a sufficiently sized range, allocate a huge page >>sized and aligned bl

Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-09 Thread anthony . yznaga
On 11/09/2018 04:13 AM, Kirill A. Shutemov wrote: > On Thu, Nov 08, 2018 at 10:48:58PM -0800, Anthony Yznaga wrote: >> The basic idea as outlined by Mel Gorman in [2] is: >> >> 1) On first fault in a sufficiently sized range, allocate a huge page >>sized and

Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-09 Thread anthony . yznaga
On 11/09/2018 07:34 AM, Zi Yan wrote: > On 9 Nov 2018, at 8:11, Mel Gorman wrote: > >> On Fri, Nov 09, 2018 at 03:13:18PM +0300, Kirill A. Shutemov wrote: >>> On Thu, Nov 08, 2018 at 10:48:58PM -0800, Anthony Yznaga wrote: >>>> The basic idea as outlined by Mel

Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2018-11-09 Thread anthony . yznaga
On 11/09/2018 11:51 AM, Andrea Arcangeli wrote: > Hello, > > On Fri, Nov 09, 2018 at 03:13:18PM +0300, Kirill A. Shutemov wrote: >> On Thu, Nov 08, 2018 at 10:48:58PM -0800, Anthony Yznaga wrote: >>> The basic idea as outlined by Mel Gorman in [2] is: >>> >&g

[PATCH v2] /proc/kpagecount: return 0 for special pages that are never mapped

2018-12-10 Thread Anthony Yznaga
Certain pages that are never mapped to userspace have a type indicated in the page_type field of their struct pages (e.g. PG_buddy). page_type overlaps with _mapcount so set the count to 0 and avoid calling page_mapcount() for these pages. Signed-off-by: Anthony Yznaga Acked-by: Matthew Wilcox

Re: [RFC PATCH 3/5] mm: introduce VM_EXEC_KEEP

2020-07-29 Thread Anthony Yznaga
On 7/29/20 6:52 AM, Kirill A. Shutemov wrote: > On Mon, Jul 27, 2020 at 10:11:25AM -0700, Anthony Yznaga wrote: >> A vma with the VM_EXEC_KEEP flag is preserved across exec. For anonymous >> vmas only. For safety, overlap with fixed address VMAs created in the new >> mm

[RFC v2 15/43] PKRAM: provide a way to ban pages from use by PKRAM

2021-03-30 Thread Anthony Yznaga
: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 2 + mm/pkram.c| 205 ++ 2 files changed, 207 insertions(+) diff --git a/include/linux/pkram.h b/include/linux/pkram.h index c2099a4f2004..97a7c2ac44a9 100644

[RFC v2 04/43] mm: PKRAM: implement page stream operations

2021-03-30 Thread Anthony Yznaga
freed after the last user puts it. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 42 +++- mm/pkram.c| 282 +- 2 files changed, 317 insertions(+), 7 deletions(-) diff --git a/include/linux

[RFC v2 08/43] mm: PKRAM: introduce super block

2021-03-30 Thread Anthony Yznaga
pkram' boot param. For that purpose, the pkram super block pfn is exported via /sys/kernel/pkram. If none is passed, any preserved memory will not be kept, and a new super block will be allocated. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pkr

[RFC v2 05/43] mm: PKRAM: support preserving transparent hugepages

2021-03-30 Thread Anthony Yznaga
Support preserving a transparent hugepage by recording the page order and a flag indicating it is a THP. Use these values when the page is restored to reconstruct the THP. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 20 1 file changed, 16 insertions(+), 4 deletions

[RFC v2 12/43] mm: PKRAM: reserve preserved memory at boot

2021-03-30 Thread Anthony Yznaga
Keep preserved pages from being recycled during boot by adding them to the memblock reserved list during early boot. If memory reservation fails (e.g. a region has already been reserved), all preserved pages are dropped. Signed-off-by: Anthony Yznaga --- arch/x86/kernel/setup.c | 3 ++ arch

[RFC v2 01/43] mm: add PKRAM API stubs and Kconfig

2021-03-30 Thread Anthony Yznaga
) /* free the object */ pkram_finish_load_obj() /* free the node */ pkram_finish_load() Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 47 + mm/Kconfig| 9 +++ mm/Makefile | 1 + mm/pkram.c| 179

[RFC v2 00/43] PKRAM: Preserved-over-Kexec RAM

2021-03-30 Thread Anthony Yznaga
_files/kvmforum2019/66/VMM-fast-restart_kvmforum2019.pdf [3] https://www.youtube.com/watch?v=pBsHnf93tcQ https://static.sched.com/hosted_files/kvmforum2020/10/Device-Keepalive-State-KVMForum2020.pdf Anthony Yznaga (43): mm: add PKRAM API stubs and Kconfig mm: PKRAM: implement node load and save funct

[RFC v2 07/43] mm: PKRAM: link nodes by pfn before reboot

2021-03-30 Thread Anthony Yznaga
Since page structs are used for linking PKRAM nodes and cleared on boot, organize all PKRAM nodes into a list singly-linked by pfns before reboot to facilitate restoring the node list in the new kernel. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pkram.c | 50

[RFC v2 02/43] mm: PKRAM: implement node load and save functions

2021-03-30 Thread Anthony Yznaga
pkram_finish_load() function must be called to free the node. Nodes are also deleted when a save operation is discarded, i.e. pkram_discard_save() is called instead of pkram_finish_save(). Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 8 ++- mm/pkram.c

[RFC v2 09/43] PKRAM: track preserved pages in a physical mapping pagetable

2021-03-30 Thread Anthony Yznaga
existing architecture definitions for building a memory mapping pagetable except that a bitmap is used to represent the presence or absence of preserved pages at the PTE level. Signed-off-by: Anthony Yznaga --- mm/Makefile | 2 +- mm/pkram.c | 30 +++- mm/pkram_pagetable.c

[RFC v2 17/43] PKRAM: provide a way to check if a memory range has preserved pages

2021-03-30 Thread Anthony Yznaga
When a kernel is loaded for kexec the address ranges where the kexec segments will be copied to may conflict with pages already set to be preserved. Provide a way to determine if preserved pages exist in a specified range. Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 2 ++ mm

[RFC v2 16/43] kexec: PKRAM: prevent kexec clobbering preserved pages in some cases

2021-03-30 Thread Anthony Yznaga
reboot. Not yet handled is the case where pages have been preserved before a kexec kernel is loaded. This will be covered by a later patch. Signed-off-by: Anthony Yznaga --- kernel/kexec.c | 9 + kernel/kexec_file.c | 10 ++ 2 files changed, 19 insertions(+) diff --git a

[RFC v2 18/43] kexec: PKRAM: avoid clobbering already preserved pages

2021-03-30 Thread Anthony Yznaga
-off-by: Anthony Yznaga --- kernel/kexec_core.c | 3 +++ kernel/kexec_file.c | 5 + 2 files changed, 8 insertions(+) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index a0b6780740c8..fda4abb865ff 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -37,6 +37,7 @@ #include

[RFC v2 10/43] PKRAM: pass a list of preserved ranges to the next kernel

2021-03-30 Thread Anthony Yznaga
not prepared to avoid possible conflicts with changes in a newer kernel and to avoid having to allocate a contiguous range larger than a page. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 183 ++--- 1 file changed, 176 insertions(+), 7

[RFC v2 19/43] mm: PKRAM: allow preserved memory to be freed from userspace

2021-03-30 Thread Anthony Yznaga
To free all space utilized for preserved memory, one can write 0 to /sys/kernel/pkram. This will destroy all PKRAM nodes that are not currently being read or written. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pkram.c | 39 ++- 1

[RFC v2 21/43] x86/KASLR: PKRAM: support physical kaslr

2021-03-30 Thread Anthony Yznaga
Avoid regions of memory that contain preserved pages when computing slots used to select where to put the decompressed kernel. Signed-off-by: Anthony Yznaga --- arch/x86/boot/compressed/Makefile | 3 ++ arch/x86/boot/compressed/kaslr.c | 10 +++- arch/x86/boot/compressed/misc.h | 10

[RFC v2 23/43] mm: shmem: introduce shmem_insert_page

2021-03-30 Thread Anthony Yznaga
-off-by: Anthony Yznaga --- include/linux/shmem_fs.h | 3 ++ mm/shmem.c | 77 2 files changed, 80 insertions(+) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index d82b6f396588..3f0dd95efd46 100644 --- a/include

[RFC v2 22/43] x86/boot/compressed/64: use 1GB pages for mappings

2021-03-30 Thread Anthony Yznaga
results in the need for far fewer page table pages. As is this breaks AMD SEV-ES which expects the mappings to be 2M. This could possibly be fixed by updating split code to split 1GB page if the aren't any other issues with using 1GB mappings. Signed-off-by: Anthony Yznaga --- arch/x86

[RFC v2 24/43] mm: shmem: enable saving to PKRAM

2021-03-30 Thread Anthony Yznaga
implified: it supports only regular files in the root directory without multiple hard links, and it does not save swapped out files and aborts if any are found. However, it can be elaborated to fully support tmpfs. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/shmem_

[RFC v2 13/43] PKRAM: free the preserved ranges list

2021-03-30 Thread Anthony Yznaga
Free the pages used to pass the preserved ranges to the new boot. Signed-off-by: Anthony Yznaga --- arch/x86/mm/init_64.c | 1 + include/linux/pkram.h | 2 ++ mm/pkram.c| 20 3 files changed, 23 insertions(+) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm

[RFC v2 28/43] x86/mm/numa: add numa_isolate_memblocks()

2021-03-30 Thread Anthony Yznaga
. Signed-off-by: Anthony Yznaga --- arch/x86/include/asm/numa.h | 4 arch/x86/mm/numa.c | 32 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index e3bae2b60a0d..632b5b6d8cb3

[RFC v2 03/43] mm: PKRAM: implement object load and save functions

2021-03-30 Thread Anthony Yznaga
() is called to free the object. Objects are also deleted when a save operation is discarded. Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 2 ++ mm/pkram.c| 72 --- 2 files changed, 70 insertions(+), 4 deletions(-) diff

[RFC v2 26/43] mm: shmem: specify the mm to use when inserting pages

2021-03-30 Thread Anthony Yznaga
Explicitly specify the mm to pass to shmem_insert_page() when the pkram_stream is initialized rather than use the mm of the current thread. This will allow for multiple kernel threads to target the same mm when inserting pages in parallel. Signed-off-by: Anthony Yznaga --- mm/shmem_pkram.c | 6

[RFC v2 06/43] mm: PKRAM: implement byte stream operations

2021-03-30 Thread Anthony Yznaga
This patch adds the ability to save an arbitrary byte streams to a a PKRAM object using pkram_write() to be restored later using pkram_read(). Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 11 + mm/pkram.c| 123

[RFC v2 14/43] PKRAM: prevent inadvertent use of a stale superblock

2021-03-30 Thread Anthony Yznaga
When pages have been saved to be preserved by the current boot, set a magic number on the super block to be validated by the next kernel. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 9 + 1 file changed, 9 insertions(+) diff --git a/mm/pkram.c b/mm/pkram.c index dab6657080bf

[RFC v2 32/43] shmem: preserve shmem files a chunk at a time

2021-03-30 Thread Anthony Yznaga
To prepare for multithreading the work to preserve a shmem file, divide the work into subranges of the total index range of the file. The chunk size is a rather arbitrary 256k indices. Signed-off-by: Anthony Yznaga --- mm/shmem_pkram.c | 64

[RFC v2 29/43] PKRAM: ensure memblocks with preserved pages init'd for numa

2021-03-30 Thread Anthony Yznaga
In order to facilitate fast initialization of page structs for preserved pages, memblocks with preserved pages must not cross numa node boundaries and must have a node id assigned to them. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 9 + 1 file changed, 9 insertions(+) diff --git a

[RFC v2 27/43] mm: shmem: when inserting, handle pages already charged to a memcg

2021-03-30 Thread Anthony Yznaga
ff-by: Anthony Yznaga --- mm/shmem.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 8dfe80aeee97..44cc158ab34d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -671,7 +671,7 @@ static inline bool is_huge_enabled(struct shmem_sb_info *s

[RFC v2 11/43] PKRAM: prepare for adding preserved ranges to memblock reserved

2021-03-30 Thread Anthony Yznaga
that does not overlap any preserved range, and populate it with a new, merged regions array. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 241 + 1 file changed, 241 insertions(+) diff --git a/mm/pkram.c b/mm/pkram.c index 4cfa236a4126

[RFC v2 30/43] memblock: PKRAM: mark memblocks that contain preserved pages

2021-03-30 Thread Anthony Yznaga
To support deferred initialization of page structs for preserved pages, separate memblocks containing preserved pages by setting a new flag when adding them to the memblock reserved list. Signed-off-by: Anthony Yznaga --- include/linux/memblock.h | 6 ++ mm/pkram.c | 2 ++ 2

[RFC v2 33/43] PKRAM: atomically add and remove link pages

2021-03-30 Thread Anthony Yznaga
Add and remove pkram_link pages from a pkram_obj atomically to prepare for multithreading. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 39 --- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/mm/pkram.c b/mm/pkram.c index 08144c18d425

[RFC v2 35/43] shmem: introduce shmem_insert_pages()

2021-03-30 Thread Anthony Yznaga
the shmem_inode_info lock and prepare for future optimizations, introduce shmem_insert_pages() which allows a caller to pass an array of pages to be inserted into a shmem segment. Signed-off-by: Anthony Yznaga --- include/linux/shmem_fs.h | 3 +- mm/shmem.c | 93

[RFC v2 20/43] PKRAM: disable feature when running the kdump kernel

2021-03-30 Thread Anthony Yznaga
The kdump kernel should not preserve or restore pages. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/pkram.c b/mm/pkram.c index 8700fd77dc67..aea069cc49be 100644 --- a/mm/pkram.c +++ b/mm/pkram.c @@ -1,4 +1,5

[RFC v2 37/43] shmem: PKRAM: enable bulk loading of preserved pages into shmem

2021-03-30 Thread Anthony Yznaga
Make use of new interfaces for loading and inserting preserved pages into a shmem file in bulk. Signed-off-by: Anthony Yznaga --- mm/shmem_pkram.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mm/shmem_pkram.c b/mm/shmem_pkram.c index 354c2b58962c

[RFC v2 25/43] mm: shmem: prevent swapping of PKRAM-enabled tmpfs pages

2021-03-30 Thread Anthony Yznaga
Work around the limitation that shmem pages must be in memory in order to be preserved by preventing them from being swapped out in the first place. Do this by marking shmem pages associated with a PKRAM node as unevictable. Signed-off-by: Anthony Yznaga --- mm/shmem.c | 2 ++ 1 file changed

[RFC v2 34/43] shmem: PKRAM: multithread preserving and restoring shmem pages

2021-03-30 Thread Anthony Yznaga
: Anthony Yznaga --- mm/shmem_pkram.c | 94 +--- 1 file changed, 89 insertions(+), 5 deletions(-) diff --git a/mm/shmem_pkram.c b/mm/shmem_pkram.c index e52722b3a709..354c2b58962c 100644 --- a/mm/shmem_pkram.c +++ b/mm/shmem_pkram.c @@ -115,6 +115,7

[RFC v2 38/43] mm: implement splicing a list of pages to the LRU

2021-03-30 Thread Anthony Yznaga
. For now only unevictable pages are supported. Signed-off-by: Anthony Yznaga --- include/linux/swap.h | 13 mm/swap.c| 86 2 files changed, 99 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index

[RFC v2 40/43] shmem: initial support for adding multiple pages to pagecache

2021-03-30 Thread Anthony Yznaga
, but improvements in performance when multiple threads are adding to the same pagecache are achieved by calling a new shmem_add_to_page_cache_fast() function that does not check for conflicts and drops the xarray lock before updating stats. Signed-off-by: Anthony Yznaga --- mm/shmem.c | 123

[RFC v2 36/43] PKRAM: add support for loading pages in bulk

2021-03-30 Thread Anthony Yznaga
index of the first page are provided to the caller. Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 4 mm/pkram.c| 46 ++ 2 files changed, 50 insertions(+) diff --git a/include/linux/pkram.h b/include/linux/pkram.h index

[RFC v2 43/43] PKRAM: improve index alignment of pkram_link entries

2021-03-30 Thread Anthony Yznaga
and the next aligned page will not fit on the pkram_link page. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mm/pkram.c b/mm/pkram.c index b63b2a3958e7..3f43809c8a85 100644 --- a/mm/pkram.c +++ b/mm/pkram.c @@ -911,9

[RFC v2 42/43] shmem: reduce time holding xa_lock when inserting pages

2021-03-30 Thread Anthony Yznaga
, add them to a local xarray, export the xarray node, and then take the lock on the page cache xarray and insert the node. Signed-off-by: Anthony Yznaga --- mm/shmem.c | 162 ++--- 1 file changed, 156 insertions(+), 6 deletions(-) diff --git

[RFC v2 41/43] XArray: add xas_export_node() and xas_import_node()

2021-03-30 Thread Anthony Yznaga
it. Signed-off-by: Anthony Yznaga --- Documentation/core-api/xarray.rst | 8 +++ include/linux/xarray.h| 2 + lib/test_xarray.c | 45 + lib/xarray.c | 100 ++ 4 files changed, 155 insertions

[RFC v2 31/43] memblock, mm: defer initialization of preserved pages

2021-03-30 Thread Anthony Yznaga
skipping them when other reserved pages are initialized and initializing them later with a separate kernel thread. Signed-off-by: Anthony Yznaga --- arch/x86/mm/init_64.c | 1 - include/linux/mm.h| 2 +- mm/memblock.c | 11 +-- mm/page_alloc.c | 55

[RFC v2 39/43] shmem: optimize adding pages to the LRU in shmem_insert_pages()

2021-03-30 Thread Anthony Yznaga
Reduce LRU lock contention when inserting shmem pages by staging pages to be added to the same LRU and adding them en masse. Signed-off-by: Anthony Yznaga --- mm/shmem.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index c3fa72061d8a

Re: [RFC v2 01/43] mm: add PKRAM API stubs and Kconfig

2021-03-31 Thread Anthony Yznaga
On 3/31/21 11:43 AM, Randy Dunlap wrote: > On 3/30/21 2:35 PM, Anthony Yznaga wrote: >> Preserved-across-kexec memory or PKRAM is a method for saving memory >> pages of the currently executing kernel and restoring them after kexec >> boot into a new one. This can be utilized

Re: [PATCH] mm,memory_hotplug: Fix scan_movable_pages for gigantic hugepages

2019-01-22 Thread Anthony Yznaga
GS:88803eb0() > knlGS: > kernel: CS: 0010 DS: ES: CR0: 80050033 > kernel: CR2: 0008 CR3: 38d78006 CR4: 003606a0 > kernel: DR0: DR1: 00000000 DR2: > kernel: DR3:

Re: [RFC PATCH] mm: thp: implement THP reservations for anonymous memory

2019-01-24 Thread Anthony Yznaga
On 11/14/18 3:15 PM, anthony.yzn...@oracle.com wrote: > > > On 11/10/2018 08:44 AM, Andrea Arcangeli wrote: >> On Sat, Nov 10, 2018 at 01:22:49PM +, Mel Gorman wrote: >>> On Fri, Nov 09, 2018 at 02:51:50PM -0500, Andrea Arcangeli wrote: And if you're in the camp that is concerned abou

Re: [PATCH 1/3] coredump: Replace opencoded set_mask_bits()

2019-01-10 Thread Anthony Yznaga
-off-by: Vineet Gupta Reviewed-by: Anthony Yznaga

Re: [PATCH 2/3] fs: inode_set_flags() replace opencoded set_mask_bits()

2019-01-10 Thread Anthony Yznaga
inux-kernel@vger.kernel.org > Signed-off-by: Vineet Gupta > Reviewed-by: Anthony Yznaga

Re: [PATCH 3/3] bitops.h: set_mask_bits() to return old value

2019-01-10 Thread Anthony Yznaga
0807110955.gh16...@twins.programming.kicks-ass.net > Suggested-by: Peter Zijlstra > Cc: Miklos Szeredi > Cc: Ingo Molnar > Cc: Jani Nikula > Cc: Chris Wilson > Cc: Andrew Morton > Cc: Will Deacon > Signed-off-by: Vineet Gupta > Reviewed-by: Anthony Yznaga

Re: [PATCH v6 4/4] sparc64: Add support for ADI (Application Data Integrity)

2017-03-06 Thread Anthony Yznaga
> On Feb 28, 2017, at 10:35 AM, Khalid Aziz wrote: > > diff --git a/arch/sparc/kernel/etrap_64.S b/arch/sparc/kernel/etrap_64.S > index 1276ca2..7be33bf 100644 > --- a/arch/sparc/kernel/etrap_64.S > +++ b/arch/sparc/kernel/etrap_64.S > @@ -132,7 +132,33 @@ etrap_save: save%g2, -STACK_BI

Re: [PATCH v6 4/4] sparc64: Add support for ADI (Application Data Integrity)

2017-03-06 Thread Anthony Yznaga
> On Mar 6, 2017, at 4:31 PM, Khalid Aziz wrote: > > On 03/06/2017 05:13 PM, Anthony Yznaga wrote: >> >>> On Feb 28, 2017, at 10:35 AM, Khalid Aziz wrote: >>> >>> diff --git a/arch/sparc/kernel/etrap_64.S b/arch/sparc/kernel/etrap_64.S >>>

[PATCH 3/3] KVM: x86: minor code refactor and comments fixup around dirty logging

2020-06-02 Thread Anthony Yznaga
Consolidate the code and correct the comments to show that the actions taken to update existing mappings to disable or enable dirty logging are not necessary when creating, moving, or deleting a memslot. Signed-off-by: Anthony Yznaga --- arch/x86/kvm/x86.c | 104

[PATCH 2/3] KVM: x86: avoid unnecessary rmap walks when creating/moving slots

2020-06-02 Thread Anthony Yznaga
properties of the new slot. Signed-off-by: Anthony Yznaga --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 23fd888e52ee..d211c8ced6bb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10138,7 +10138,7

[PATCH 1/3] KVM: x86: remove unnecessary rmap walk of read-only memslots

2020-06-02 Thread Anthony Yznaga
There's no write access to remove. An existing memslot cannot be updated to set or clear KVM_MEM_READONLY, and any mappings established in a newly created or moved read-only memslot will already be read-only. Signed-off-by: Anthony Yznaga --- arch/x86/kvm/x86.c | 6 ++ 1 file chang

[PATCH 0/3] avoid unnecessary memslot rmap walks

2020-06-02 Thread Anthony Yznaga
won't need updating. I can't find any reason for this not to be the case, but I've taken a more cautious approach to fixing this by dividing things into three patches. Anthony Yznaga (3): KVM: x86: remove unnecessary rmap walk of read-only memslots KVM: x86: avoid unneces

[RFC PATCH 2/5] mm: do not assume only the stack vma exists in setup_arg_pages()

2020-07-27 Thread Anthony Yznaga
there is no vma between the vma passed to it and the address to expand to, so check before calling it. Signed-off-by: Anthony Yznaga --- fs/exec.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/exec.c b/fs/exec.c index e6e8a9a70327..262112e5f9f8 100644 --- a/fs/exec.c

[RFC PATCH 4/5] exec, elf: require opt-in for accepting preserved mem

2020-07-27 Thread Anthony Yznaga
Don't copy preserved VMAs to the binary being exec'd unless the binary has a "preserved-mem-ok" ELF note. Signed-off-by: Anthony Yznaga --- fs/binfmt_elf.c | 84 + fs/exec.c | 17 +- include/

[RFC PATCH 1/5] elf: reintroduce using MAP_FIXED_NOREPLACE for elf executable mappings

2020-07-27 Thread Anthony Yznaga
nue to map at a system-selected address in the mmap region. Signed-off-by: Anthony Yznaga --- fs/binfmt_elf.c | 112 1 file changed, 64 insertions(+), 48 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 9fe3b51c116a..6445

[RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-27 Thread Anthony Yznaga
et up. Patch 1 re-introduces the use of MAP_FIXED_NOREPLACE to load ELF binaries that addresses the previous issues and could be considered on its own. Patches 3, 4, and 5 introduce the feature and an opt-in method for its use using an ELF note. Anthony Yznaga (5): elf: reintroduce

[RFC PATCH 3/5] mm: introduce VM_EXEC_KEEP

2020-07-27 Thread Anthony Yznaga
no conflicts. Comments welcome.) Signed-off-by: Steve Sistare Signed-off-by: Anthony Yznaga --- arch/x86/Kconfig | 1 + fs/exec.c | 20 include/linux/mm.h | 5 + kernel/fork.c | 2 +- mm/mmap.c | 47

[RFC PATCH 5/5] mm: introduce MADV_DOEXEC

2020-07-27 Thread Anthony Yznaga
reverts to MADV_DONTEXEC. Signed-off-by: Steve Sistare Signed-off-by: Anthony Yznaga --- include/uapi/asm-generic/mman-common.h | 3 +++ mm/madvise.c | 25 + 2 files changed, 28 insertions(+) diff --git a/include/uapi/asm-generic/mman-common.h

Re: [RFC PATCH 0/5] madvise MADV_DOEXEC

2020-07-28 Thread Anthony Yznaga
On 7/28/20 4:34 AM, Kirill Tkhai wrote: > On 27.07.2020 20:11, Anthony Yznaga wrote: >> This patchset adds support for preserving an anonymous memory range across >> exec(3) using a new madvise MADV_DOEXEC argument. The primary benefit for >> sharing memory in this man

Re: [RFC PATCH 3/5] mm: introduce VM_EXEC_KEEP

2020-07-28 Thread Anthony Yznaga
On 7/28/20 6:38 AM, ebied...@xmission.com wrote: > Anthony Yznaga writes: > >> A vma with the VM_EXEC_KEEP flag is preserved across exec. For anonymous >> vmas only. For safety, overlap with fixed address VMAs created in the new >> mm during exec (e.g. the stack and e

[RFC 13/43] mm: PKRAM: free preserved pages pagetable

2020-05-06 Thread Anthony Yznaga
as pages. Signed-off-by: Anthony Yznaga --- arch/x86/mm/init_64.c | 1 + include/linux/pkram.h | 3 ++ mm/pkram.c| 11 +++ mm/pkram_pagetable.c | 82 +++ 4 files changed, 97 insertions(+) diff --git a/arch/x86/mm/init_64.c b/arch

[RFC 06/43] mm: PKRAM: implement byte stream operations

2020-05-06 Thread Anthony Yznaga
This patch adds the ability to save arbitrary byte streams up to a total length of one page to a PKRAM object using pkram_write() to be restored later using pkram_read(). Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 4 +++ mm/pkram.c

[RFC 00/43] PKRAM: Preserved-over-Kexec RAM

2020-05-06 Thread Anthony Yznaga
h?v=pBsHnf93tcQ https://static.sched.com/hosted_files/kvmforum2019/66/VMM-fast-restart_kvmforum2019.pdf Anthony Yznaga (43): mm: add PKRAM API stubs and Kconfig mm: PKRAM: implement node load and save functions mm: PKRAM: implement object load and save functions mm: PKRAM: implement page

[RFC 07/43] mm: PKRAM: link nodes by pfn before reboot

2020-05-06 Thread Anthony Yznaga
Since page structs are used for linking PKRAM nodes and cleared on boot, organize all PKRAM nodes into a list singly-linked by pfns before reboot to facilitate the node list restore in the new kernel. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pkram.c | 50

[RFC 16/43] kexec: PKRAM: prevent kexec clobbering preserved pages in some cases

2020-05-06 Thread Anthony Yznaga
reboot. Not yet handled is the case where pages have been preserved before a kexec kernel is loaded. This will be covered by a later patch. Signed-off-by: Anthony Yznaga --- kernel/kexec.c | 9 + kernel/kexec_file.c | 10 ++ 2 files changed, 19 insertions(+) diff --git a

[RFC 19/43] mm: PKRAM: allow preserved memory to be freed from userspace

2020-05-06 Thread Anthony Yznaga
To free all space utilized for preserved memory, one can write 0 to /sys/kernel/pkram. This will destroy all PKRAM nodes that are not currently being read or written. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pkram.c | 39 ++- 1

[RFC 02/43] mm: PKRAM: implement node load and save functions

2020-05-06 Thread Anthony Yznaga
pkram_finish_load() function must be called to free the node. Nodes are also deleted when a save operation is discarded, i.e. pkram_discard_save() is called instead of pkram_finish_save(). Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 7 ++- mm/pkram.c

[RFC 24/43] mm: shmem: prevent swapping of PKRAM-enabled tmpfs pages

2020-05-06 Thread Anthony Yznaga
Workaround the limitation that shmem pages must be in memory in order to be preserved by preventing them from being swapped out in the first place. Do this by marking shmem pages associated with a PKRAM node as unevictable. Signed-off-by: Anthony Yznaga --- mm/shmem.c | 2 ++ 1 file changed, 2

[RFC 08/43] mm: PKRAM: introduce super block

2020-05-06 Thread Anthony Yznaga
pkram' boot param. For that purpose, the pkram super block pfn is exported via /sys/kernel/pkram. If none is passed, any preserved memory will not be kept, and a new super block will be allocated. Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga --- mm/pk

[RFC 25/43] mm: shmem: specify the mm to use when inserting pages

2020-05-06 Thread Anthony Yznaga
Explicitly specify the mm to pass to shmem_insert_page() when the pkram_stream is initialized rather than use the mm of the current thread. This will allow for multiple kernel threads to target the same mm when inserting pages in parallel. Signed-off-by: Anthony Yznaga --- include/linux

[RFC 14/43] mm: memblock: PKRAM: prevent memblock resize from clobbering preserved pages

2020-05-06 Thread Anthony Yznaga
around memblock_find_in_range() walks the preserved pages pagetable to find sufficiently sized ranges without preserved pages and passes them to memblock_find_in_range(). Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 3 +++ mm/memblock.c | 15 +-- mm/pkram.c

[RFC 20/43] PKRAM: disable feature when running the kdump kernel

2020-05-06 Thread Anthony Yznaga
The kdump kernel should not preserve or restore pages. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/pkram.c b/mm/pkram.c index 95e691382721..4d4d836fea53 100644 --- a/mm/pkram.c +++ b/mm/pkram.c @@ -1,4 +1,5

[RFC 11/43] PKRAM: pass the preserved pages pagetable to the next kernel

2020-05-06 Thread Anthony Yznaga
Add a pointer to the pagetable to the pkram_super_block page. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mm/pkram.c b/mm/pkram.c index 5a7b8f61a55d..54b2779d0813 100644 --- a/mm/pkram.c +++ b/mm/pkram.c

[RFC 09/43] PKRAM: build a physical mapping pagetable of pages to be preserved

2020-05-06 Thread Anthony Yznaga
general both metadata pages and data pages must be added to the pagetable. A mapping for a metadata page can be added when the page is allocated, but there is an exception: for the pagetable pages themselves mappings are added after they are allocated to avoid recursion. Signed-off-by: Anthony

[RFC 21/43] x86/KASLR: PKRAM: support physical kaslr

2020-05-06 Thread Anthony Yznaga
Avoid regions of memory that contain preserved pages when computing slots used to select where to put the decompressed kernel. Signed-off-by: Anthony Yznaga --- arch/x86/boot/compressed/Makefile | 3 + arch/x86/boot/compressed/kaslr.c | 67 ++ arch/x86/boot/compressed/misc.h | 19

[RFC 18/43] kexec: PKRAM: avoid clobbering already preserved pages

2020-05-06 Thread Anthony Yznaga
-off-by: Anthony Yznaga --- kernel/kexec_core.c | 3 +++ kernel/kexec_file.c | 5 + 2 files changed, 8 insertions(+) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index c19c0dad1ebe..8c24b546352e 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -37,6 +37,7 @@ #include

[RFC 01/43] mm: add PKRAM API stubs and Kconfig

2020-05-06 Thread Anthony Yznaga
node/object */ pkram_load_page()[,...] /* for page stream, or pkram_read()[,...]* ... for byte stream */ /* free the object */ pkram_finish_load_obj() /* free the node */ pkram_finish_load() Originally-by: Vladimir Davydov Signed-off-by: Anthony Yznaga

[RFC 22/43] mm: shmem: introduce shmem_insert_page

2020-05-06 Thread Anthony Yznaga
-off-by: Anthony Yznaga --- include/linux/shmem_fs.h | 3 ++ mm/shmem.c | 95 2 files changed, 98 insertions(+) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 7a35a6901221..688b92cd4ec7 100644 --- a/include

[RFC 32/43] shmem: PKRAM: preserve shmem files a chunk at a time

2020-05-06 Thread Anthony Yznaga
it initializes pkram_stream with the index range of the next available range of pages to save. find_get_pages_range() can then be used to get the pages in the range. When no more index ranges are available, pkram_prepare_save_chunk() returns -ENODATA. Signed-off-by: Anthony Yznaga --- include

[RFC 28/43] PKRAM: ensure memblocks with preserved pages init'd for numa

2020-05-06 Thread Anthony Yznaga
In order to facilitate fast initialization of page structs for preserved pages, memblocks with preserved pages must not cross numa node boundaries and must have a node id assigned to them. Signed-off-by: Anthony Yznaga --- mm/pkram.c | 10 ++ 1 file changed, 10 insertions(+) diff --git

[RFC 30/43] memblock: add for_each_reserved_mem_range()

2020-05-06 Thread Anthony Yznaga
To support deferred initialization of page structs for preserved pages, add an iterator of the memblock reserved list that can select or exclude ranges based on memblock flags. Signed-off-by: Anthony Yznaga --- include/linux/memblock.h | 10 ++ mm/memblock.c| 51

[RFC 03/43] mm: PKRAM: implement object load and save functions

2020-05-06 Thread Anthony Yznaga
() is called to free the object. Objects are also deleted when a save operation is discarded. Signed-off-by: Anthony Yznaga --- include/linux/pkram.h | 1 + mm/pkram.c| 77 --- 2 files changed, 74 insertions(+), 4 deletions(-) diff

  1   2   >