linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/5] Add hugetlb soft dirty support
@ 2021-02-11  0:03 Mike Kravetz
  2021-02-11  0:03 ` [RFC PATCH 1/5] hugetlb: add hugetlb helpers for " Mike Kravetz
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Mike Kravetz @ 2021-02-11  0:03 UTC (permalink / raw)
  To: linux-mm, linux-kernel, linux-s390
  Cc: shu wang, Axel Rasmussen, Peter Xu, Andrea Arcangeli,
	Heiko Carstens, Alexey Dobriyan, Matthew Wilcox,
	Michel Lespinasse, Andrew Morton, Mike Kravetz

Shu Wang opened bugzilla 211287 [1] saying,
When a memory region is mapped with huge pages, the softdirty bit is set
only right after the huge pages is mapped. After the memory mapping, if
the softdirty bit is cleared and the memory is written again, the softdirty
bit is not set when reading from the process's pagemap.

Their use case for hugetlb soft dirty is,
We maps both PMEM and hugetlb DRAM to process’s address space to provide
large amount of memory to the application. Periodically, we clear the soft
dirty bit by writing ‘4’ to the clear_refs. Then, we check the page’s soft
dirty bit from pagemap and use this information to track write activity to
memory. We migrate the data between DRAM and PMEM based the write activity
for better performance.

A quick check of the code revealed,
The /proc clear_refs code handles THP pages and 'normal' pages.  There is
no check/processing for hugetlb pages.  All the code will do is clear the
VM_SOFTDIRTY vma flag and vma_set_page_prot.  None of the individual ptes
or page flags are touched.

The only soft dirty checking done by the /proc pagemap code is at the vma
level.  It checks the VM_SOFTDIRTY flag.   It does not look for soft dirty
on the individual ptes.

That explains the behavior described in the bugzilla report.

This series adds soft dirty support for hugetlb.  It has only passed
some very basic testing and likely needs more work.  However, Axel
Rasmussen's "userfaultfd: add minor fault handling" and Peter Xu's
"userfaultfd-wp: Support shmem and hugetlbfs" work touch the same areas
and have similiar issues.  Therefore, code is being sent earlier than
normal so that efforts in common areas can be coordinated.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=211287

Mike Kravetz (5):
  hugetlb: add hugetlb helpers for soft dirty support
  hugetlb: enhance hugetlb fault processing to support soft dirty
  mm proc/task_mmu.c: add soft dirty pte checks for hugetlb
  hugetlb: don't permit pmd sharing if soft dirty in use
  mm proc/task_mmu.c: add hugetlb specific routine for clear_refs

 arch/s390/include/asm/hugetlb.h |  30 +++++++++
 fs/proc/task_mmu.c              | 114 ++++++++++++++++++++++++++++++++
 include/asm-generic/hugetlb.h   |  30 +++++++++
 include/linux/hugetlb.h         |   1 +
 mm/hugetlb.c                    |  40 ++++++-----
 5 files changed, 199 insertions(+), 16 deletions(-)

-- 
2.29.2



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-02-24 16:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11  0:03 [RFC PATCH 0/5] Add hugetlb soft dirty support Mike Kravetz
2021-02-11  0:03 ` [RFC PATCH 1/5] hugetlb: add hugetlb helpers for " Mike Kravetz
2021-02-17 16:24   ` Peter Xu
2021-02-18 22:58     ` Mike Kravetz
2021-02-24 16:46     ` Gerald Schaefer
2021-02-24 16:55       ` Gerald Schaefer
2021-02-11  0:03 ` [RFC PATCH 2/5] hugetlb: enhance hugetlb fault processing to support soft dirty Mike Kravetz
2021-02-17 19:32   ` Peter Xu
2021-02-18 23:26     ` Mike Kravetz
2021-02-11  0:03 ` [RFC PATCH 3/5] mm proc/task_mmu.c: add soft dirty pte checks for hugetlb Mike Kravetz
2021-02-17 19:35   ` Peter Xu
2021-02-18 23:59     ` Mike Kravetz
2021-02-11  0:03 ` [RFC PATCH 4/5] hugetlb: don't permit pmd sharing if soft dirty in use Mike Kravetz
2021-02-17 19:44   ` Peter Xu
2021-02-11  0:03 ` [RFC PATCH 5/5] mm proc/task_mmu.c: add hugetlb specific routine for clear_refs Mike Kravetz
2021-02-17 20:25   ` Peter Xu
2021-02-19  0:14     ` Mike Kravetz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).