linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] mm: Use pte marker for swapin errors
@ 2022-10-24 20:48 Peter Xu
  2022-10-24 20:48 ` [PATCH RFC 1/2] mm: Always compile in pte markers Peter Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Peter Xu @ 2022-10-24 20:48 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Huang Ying, peterx, Andrew Morton, HORIGUCHI NAOYA, Miaohe Lin,
	David Hildenbrand, Andrea Arcangeli

Hi,

This series uses the pte marker to replace the swapin error swap entry,
then we safe one more swap entry.  A new pte marker bit is defined.

One thing worth mentioning: we need the pte marker to be always built to
make sure it works like before, so I made an attempt in patch 1 to drop
CONFIG_PTE_MARKER and always compile pte marker in.  Since pte markers are
enabled in many distributions by default already, meanwhile the codeset is
really small I assume it's fine.  But still I'm tagging with RFC for this
initial version.

Smoke tested on anonymous mem on a fake swap failure.  Please have a look,
thanks.

Peter Xu (2):
  mm: Always compile in pte markers
  mm: Use pte markers for swap errors

 include/linux/swap.h    | 16 ++++----------
 include/linux/swapops.h | 49 +++++++++--------------------------------
 mm/Kconfig              |  7 ------
 mm/memory.c             | 13 ++++++-----
 mm/shmem.c              |  2 +-
 mm/swapfile.c           |  2 +-
 6 files changed, 23 insertions(+), 66 deletions(-)

-- 
2.37.3



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

* [PATCH RFC 1/2] mm: Always compile in pte markers
  2022-10-24 20:48 [PATCH RFC 0/2] mm: Use pte marker for swapin errors Peter Xu
@ 2022-10-24 20:48 ` Peter Xu
  2022-10-29  2:35   ` Miaohe Lin
  2022-10-24 20:48 ` [PATCH RFC 2/2] mm: Use pte markers for swap errors Peter Xu
  2022-10-25  3:01 ` [PATCH RFC 0/2] mm: Use pte marker for swapin errors Huang, Ying
  2 siblings, 1 reply; 9+ messages in thread
From: Peter Xu @ 2022-10-24 20:48 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Huang Ying, peterx, Andrew Morton, HORIGUCHI NAOYA, Miaohe Lin,
	David Hildenbrand, Andrea Arcangeli

The PTE markers code is tiny and now it's enabled for most of the
distributions.  It's fine to keep it as-is, but to make a broader use of
it (e.g. replacing read error swap entry) it needs to be there always
otherwise we need special code path to take care of !PTE_MARKER case.

It'll be easier just make pte marker always exist.  Use this chance to
extend its usage to anonymous too by simply touching up some of the old
comments, because it'll be used for anonymous pages in the follow up
patches.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/linux/swap.h    | 10 +++-------
 include/linux/swapops.h | 31 -------------------------------
 mm/Kconfig              |  7 -------
 mm/memory.c             |  7 +++----
 4 files changed, 6 insertions(+), 49 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 369d7799205d..211aeca9bfa7 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -60,17 +60,13 @@ static inline int current_is_kswapd(void)
 			     SWP_MIGRATION_NUM + SWP_DEVICE_NUM + \
 			     SWP_PTE_MARKER_NUM)
 /*
- * PTE markers are used to persist information onto PTEs that are mapped with
- * file-backed memories.  As its name "PTE" hints, it should only be applied to
- * the leaves of pgtables.
+ * PTE markers are used to persist information onto PTEs that otherwise
+ * should be a none pte.  As its name "PTE" hints, it should only be
+ * applied to the leaves of pgtables.
  */
-#ifdef CONFIG_PTE_MARKER
 #define SWP_PTE_MARKER_NUM 1
 #define SWP_PTE_MARKER     (MAX_SWAPFILES + SWP_HWPOISON_NUM + \
 			    SWP_MIGRATION_NUM + SWP_DEVICE_NUM)
-#else
-#define SWP_PTE_MARKER_NUM 0
-#endif
 
 /*
  * Unaddressable device memory support. See include/linux/hmm.h and
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 86b95ccb81bb..41a6e7b23415 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -412,8 +412,6 @@ typedef unsigned long pte_marker;
 #define  PTE_MARKER_UFFD_WP  BIT(0)
 #define  PTE_MARKER_MASK     (PTE_MARKER_UFFD_WP)
 
-#ifdef CONFIG_PTE_MARKER
-
 static inline swp_entry_t make_pte_marker_entry(pte_marker marker)
 {
 	return swp_entry(SWP_PTE_MARKER, marker);
@@ -434,32 +432,6 @@ static inline bool is_pte_marker(pte_t pte)
 	return is_swap_pte(pte) && is_pte_marker_entry(pte_to_swp_entry(pte));
 }
 
-#else /* CONFIG_PTE_MARKER */
-
-static inline swp_entry_t make_pte_marker_entry(pte_marker marker)
-{
-	/* This should never be called if !CONFIG_PTE_MARKER */
-	WARN_ON_ONCE(1);
-	return swp_entry(0, 0);
-}
-
-static inline bool is_pte_marker_entry(swp_entry_t entry)
-{
-	return false;
-}
-
-static inline pte_marker pte_marker_get(swp_entry_t entry)
-{
-	return 0;
-}
-
-static inline bool is_pte_marker(pte_t pte)
-{
-	return false;
-}
-
-#endif /* CONFIG_PTE_MARKER */
-
 static inline pte_t make_pte_marker(pte_marker marker)
 {
 	return swp_entry_to_pte(make_pte_marker_entry(marker));
@@ -477,9 +449,6 @@ static inline pte_t make_pte_marker(pte_marker marker)
  * memory, kernel-only memory (including when the system is during-boot),
  * non-ram based generic file-system.  It's fine to be used even there, but the
  * extra pte marker check will be pure overhead.
- *
- * For systems configured with !CONFIG_PTE_MARKER this will be automatically
- * optimized to pte_none().
  */
 static inline int pte_none_mostly(pte_t pte)
 {
diff --git a/mm/Kconfig b/mm/Kconfig
index 57e1d8c5b505..4b28800d9be1 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1107,17 +1107,10 @@ config HAVE_ARCH_USERFAULTFD_MINOR
 	help
 	  Arch has userfaultfd minor fault support
 
-config PTE_MARKER
-	bool
-
-	help
-	  Allows to create marker PTEs for file-backed memory.
-
 config PTE_MARKER_UFFD_WP
 	bool "Userfaultfd write protection support for shmem/hugetlbfs"
 	default y
 	depends on HAVE_ARCH_USERFAULTFD_WP
-	select PTE_MARKER
 
 	help
 	  Allows to create marker PTEs for userfaultfd write protection
diff --git a/mm/memory.c b/mm/memory.c
index 25b12d1a7db0..71114f05a68c 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3699,11 +3699,10 @@ static vm_fault_t handle_pte_marker(struct vm_fault *vmf)
 	unsigned long marker = pte_marker_get(entry);
 
 	/*
-	 * PTE markers should always be with file-backed memories, and the
-	 * marker should never be empty.  If anything weird happened, the best
-	 * thing to do is to kill the process along with its mm.
+	 * PTE markers should never be empty.  If anything weird happened,
+	 * the best thing to do is to kill the process along with its mm.
 	 */
-	if (WARN_ON_ONCE(vma_is_anonymous(vmf->vma) || !marker))
+	if (WARN_ON_ONCE(!marker))
 		return VM_FAULT_SIGBUS;
 
 	if (pte_marker_entry_uffd_wp(entry))
-- 
2.37.3



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

* [PATCH RFC 2/2] mm: Use pte markers for swap errors
  2022-10-24 20:48 [PATCH RFC 0/2] mm: Use pte marker for swapin errors Peter Xu
  2022-10-24 20:48 ` [PATCH RFC 1/2] mm: Always compile in pte markers Peter Xu
@ 2022-10-24 20:48 ` Peter Xu
  2022-10-25 15:31   ` David Hildenbrand
  2022-10-29  2:49   ` Miaohe Lin
  2022-10-25  3:01 ` [PATCH RFC 0/2] mm: Use pte marker for swapin errors Huang, Ying
  2 siblings, 2 replies; 9+ messages in thread
From: Peter Xu @ 2022-10-24 20:48 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Huang Ying, peterx, Andrew Morton, HORIGUCHI NAOYA, Miaohe Lin,
	David Hildenbrand, Andrea Arcangeli

PTE markers are ideal mechanism for things like SWP_SWAPIN_ERROR.  Using a
whole swap entry type for this purpose can be an overkill, especially if we
already have PTE markers.  Define a new bit for swapin error and replace it
with pte markers.  Then we can safely drop SWP_SWAPIN_ERROR and give one
device slot back to swap.

We used to have SWP_SWAPIN_ERROR taking the page pfn as part of the swap
entry, but it's never used.  Neither do I see how it can be useful because
normally the swapin failure should not be caused by a bad page but bad swap
device.  Drop it alongside.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/linux/swap.h    |  6 +-----
 include/linux/swapops.h | 26 ++++++++++++++------------
 mm/memory.c             |  6 ++++--
 mm/shmem.c              |  2 +-
 mm/swapfile.c           |  2 +-
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 211aeca9bfa7..fec6647a289a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -55,10 +55,6 @@ static inline int current_is_kswapd(void)
  * actions on faults.
  */
 
-#define SWP_SWAPIN_ERROR_NUM 1
-#define SWP_SWAPIN_ERROR     (MAX_SWAPFILES + SWP_HWPOISON_NUM + \
-			     SWP_MIGRATION_NUM + SWP_DEVICE_NUM + \
-			     SWP_PTE_MARKER_NUM)
 /*
  * PTE markers are used to persist information onto PTEs that otherwise
  * should be a none pte.  As its name "PTE" hints, it should only be
@@ -121,7 +117,7 @@ static inline int current_is_kswapd(void)
 #define MAX_SWAPFILES \
 	((1 << MAX_SWAPFILES_SHIFT) - SWP_DEVICE_NUM - \
 	SWP_MIGRATION_NUM - SWP_HWPOISON_NUM - \
-	SWP_PTE_MARKER_NUM - SWP_SWAPIN_ERROR_NUM)
+	SWP_PTE_MARKER_NUM)
 
 /*
  * Magic header for a swap area. The first part of the union is
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 41a6e7b23415..dd087b7287b0 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -162,16 +162,6 @@ static inline void *swp_to_radix_entry(swp_entry_t entry)
 	return xa_mk_value(entry.val);
 }
 
-static inline swp_entry_t make_swapin_error_entry(struct page *page)
-{
-	return swp_entry(SWP_SWAPIN_ERROR, page_to_pfn(page));
-}
-
-static inline int is_swapin_error_entry(swp_entry_t entry)
-{
-	return swp_type(entry) == SWP_SWAPIN_ERROR;
-}
-
 #if IS_ENABLED(CONFIG_DEVICE_PRIVATE)
 static inline swp_entry_t make_readable_device_private_entry(pgoff_t offset)
 {
@@ -409,8 +399,9 @@ static inline bool is_migration_entry_dirty(swp_entry_t entry)
 
 typedef unsigned long pte_marker;
 
-#define  PTE_MARKER_UFFD_WP  BIT(0)
-#define  PTE_MARKER_MASK     (PTE_MARKER_UFFD_WP)
+#define  PTE_MARKER_UFFD_WP			BIT(0)
+#define  PTE_MARKER_SWAP_ERROR			BIT(1)
+#define  PTE_MARKER_MASK			(BIT(2) - 1)
 
 static inline swp_entry_t make_pte_marker_entry(pte_marker marker)
 {
@@ -437,6 +428,17 @@ static inline pte_t make_pte_marker(pte_marker marker)
 	return swp_entry_to_pte(make_pte_marker_entry(marker));
 }
 
+static inline swp_entry_t make_swapin_error_entry(void)
+{
+	return make_pte_marker_entry(PTE_MARKER_SWAP_ERROR);
+}
+
+static inline int is_swapin_error_entry(swp_entry_t entry)
+{
+	return is_pte_marker_entry(entry) &&
+	    (pte_marker_get(entry) & PTE_MARKER_SWAP_ERROR);
+}
+
 /*
  * This is a special version to check pte_none() just to cover the case when
  * the pte is a pte marker.  It existed because in many cases the pte marker
diff --git a/mm/memory.c b/mm/memory.c
index 71114f05a68c..cf602c3854c3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3705,6 +3705,10 @@ static vm_fault_t handle_pte_marker(struct vm_fault *vmf)
 	if (WARN_ON_ONCE(!marker))
 		return VM_FAULT_SIGBUS;
 
+	/* Higher priority than uffd-wp when data corrupted */
+	if (marker & PTE_MARKER_SWAP_ERROR)
+		return VM_FAULT_SIGBUS;
+
 	if (pte_marker_entry_uffd_wp(entry))
 		return pte_marker_handle_uffd_wp(vmf);
 
@@ -3764,8 +3768,6 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
 			put_page(vmf->page);
 		} else if (is_hwpoison_entry(entry)) {
 			ret = VM_FAULT_HWPOISON;
-		} else if (is_swapin_error_entry(entry)) {
-			ret = VM_FAULT_SIGBUS;
 		} else if (is_pte_marker_entry(entry)) {
 			ret = handle_pte_marker(vmf);
 		} else {
diff --git a/mm/shmem.c b/mm/shmem.c
index c5f7a6668416..47dc595e98a3 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1682,7 +1682,7 @@ static void shmem_set_folio_swapin_error(struct inode *inode, pgoff_t index,
 	swp_entry_t swapin_error;
 	void *old;
 
-	swapin_error = make_swapin_error_entry(&folio->page);
+	swapin_error = make_swapin_error_entry();
 	old = xa_cmpxchg_irq(&mapping->i_pages, index,
 			     swp_to_radix_entry(swap),
 			     swp_to_radix_entry(swapin_error), 0);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 5fc1237a9f21..13f2569a6719 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1781,7 +1781,7 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd,
 		pte_t pteval;
 
 		dec_mm_counter(vma->vm_mm, MM_SWAPENTS);
-		pteval = swp_entry_to_pte(make_swapin_error_entry(page));
+		pteval = swp_entry_to_pte(make_swapin_error_entry());
 		set_pte_at(vma->vm_mm, addr, pte, pteval);
 		swap_free(entry);
 		ret = 0;
-- 
2.37.3



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

* Re: [PATCH RFC 0/2] mm: Use pte marker for swapin errors
  2022-10-24 20:48 [PATCH RFC 0/2] mm: Use pte marker for swapin errors Peter Xu
  2022-10-24 20:48 ` [PATCH RFC 1/2] mm: Always compile in pte markers Peter Xu
  2022-10-24 20:48 ` [PATCH RFC 2/2] mm: Use pte markers for swap errors Peter Xu
@ 2022-10-25  3:01 ` Huang, Ying
  2022-10-25 15:08   ` Peter Xu
  2 siblings, 1 reply; 9+ messages in thread
From: Huang, Ying @ 2022-10-25  3:01 UTC (permalink / raw)
  To: Peter Xu
  Cc: linux-kernel, linux-mm, Andrew Morton, HORIGUCHI NAOYA,
	Miaohe Lin, David Hildenbrand, Andrea Arcangeli

Peter Xu <peterx@redhat.com> writes:

> Hi,
>
> This series uses the pte marker to replace the swapin error swap entry,
> then we safe one more swap entry.  A new pte marker bit is defined.
          ~~~~               ~~~~~
          save?              file?

It's good to save one swap file.  Thanks for your patch!  Please feel
free to add my

Reviewed-by: "Huang, Ying" <ying.huang@intel.com>

for the whole series.

Best Regards,
Huang, Ying

> One thing worth mentioning: we need the pte marker to be always built to
> make sure it works like before, so I made an attempt in patch 1 to drop
> CONFIG_PTE_MARKER and always compile pte marker in.  Since pte markers are
> enabled in many distributions by default already, meanwhile the codeset is
> really small I assume it's fine.  But still I'm tagging with RFC for this
> initial version.
>
> Smoke tested on anonymous mem on a fake swap failure.  Please have a look,
> thanks.
>
> Peter Xu (2):
>   mm: Always compile in pte markers
>   mm: Use pte markers for swap errors
>
>  include/linux/swap.h    | 16 ++++----------
>  include/linux/swapops.h | 49 +++++++++--------------------------------
>  mm/Kconfig              |  7 ------
>  mm/memory.c             | 13 ++++++-----
>  mm/shmem.c              |  2 +-
>  mm/swapfile.c           |  2 +-
>  6 files changed, 23 insertions(+), 66 deletions(-)


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

* Re: [PATCH RFC 0/2] mm: Use pte marker for swapin errors
  2022-10-25  3:01 ` [PATCH RFC 0/2] mm: Use pte marker for swapin errors Huang, Ying
@ 2022-10-25 15:08   ` Peter Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Xu @ 2022-10-25 15:08 UTC (permalink / raw)
  To: Huang, Ying
  Cc: linux-kernel, linux-mm, Andrew Morton, HORIGUCHI NAOYA,
	Miaohe Lin, David Hildenbrand, Andrea Arcangeli

On Tue, Oct 25, 2022 at 11:01:32AM +0800, Huang, Ying wrote:
> Peter Xu <peterx@redhat.com> writes:
> 
> > Hi,
> >
> > This series uses the pte marker to replace the swapin error swap entry,
> > then we safe one more swap entry.  A new pte marker bit is defined.
>           ~~~~               ~~~~~
>           save?              file?
> 
> It's good to save one swap file.  Thanks for your patch!  Please feel
> free to add my
> 
> Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
> 
> for the whole series.

Thanks for the quick feedback, Ying.  I'll wait for a few more days before
a repost.

-- 
Peter Xu



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

* Re: [PATCH RFC 2/2] mm: Use pte markers for swap errors
  2022-10-24 20:48 ` [PATCH RFC 2/2] mm: Use pte markers for swap errors Peter Xu
@ 2022-10-25 15:31   ` David Hildenbrand
  2022-10-25 15:44     ` Peter Xu
  2022-10-29  2:49   ` Miaohe Lin
  1 sibling, 1 reply; 9+ messages in thread
From: David Hildenbrand @ 2022-10-25 15:31 UTC (permalink / raw)
  To: Peter Xu, linux-kernel, linux-mm
  Cc: Huang Ying, Andrew Morton, HORIGUCHI NAOYA, Miaohe Lin, Andrea Arcangeli

On 24.10.22 22:48, Peter Xu wrote:
> PTE markers are ideal mechanism for things like SWP_SWAPIN_ERROR.  Using a
> whole swap entry type for this purpose can be an overkill, especially if we
> already have PTE markers.  Define a new bit for swapin error and replace it
> with pte markers.  Then we can safely drop SWP_SWAPIN_ERROR and give one
> device slot back to swap.
> 
> We used to have SWP_SWAPIN_ERROR taking the page pfn as part of the swap
> entry, but it's never used.  Neither do I see how it can be useful because
> normally the swapin failure should not be caused by a bad page but bad swap
> device.  Drop it alongside.

[...]

>   
> -#define  PTE_MARKER_UFFD_WP  BIT(0)
> -#define  PTE_MARKER_MASK     (PTE_MARKER_UFFD_WP)
> +#define  PTE_MARKER_UFFD_WP			BIT(0)
> +#define  PTE_MARKER_SWAP_ERROR			BIT(1)

I'd suggest to keep the term SWAPIN. An error happened during swapin, 
which is why the page is corrupted.

(I remember that we discussed naming details in the original series and 
SWAPIN was the conclusion)

-- 
Thanks,

David / dhildenb



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

* Re: [PATCH RFC 2/2] mm: Use pte markers for swap errors
  2022-10-25 15:31   ` David Hildenbrand
@ 2022-10-25 15:44     ` Peter Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Xu @ 2022-10-25 15:44 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: linux-kernel, linux-mm, Huang Ying, Andrew Morton,
	HORIGUCHI NAOYA, Miaohe Lin, Andrea Arcangeli

On Tue, Oct 25, 2022 at 05:31:43PM +0200, David Hildenbrand wrote:
> > -#define  PTE_MARKER_UFFD_WP  BIT(0)
> > -#define  PTE_MARKER_MASK     (PTE_MARKER_UFFD_WP)
> > +#define  PTE_MARKER_UFFD_WP			BIT(0)
> > +#define  PTE_MARKER_SWAP_ERROR			BIT(1)
> 
> I'd suggest to keep the term SWAPIN. An error happened during swapin, which
> is why the page is corrupted.

Sure thing.

-- 
Peter Xu



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

* Re: [PATCH RFC 1/2] mm: Always compile in pte markers
  2022-10-24 20:48 ` [PATCH RFC 1/2] mm: Always compile in pte markers Peter Xu
@ 2022-10-29  2:35   ` Miaohe Lin
  0 siblings, 0 replies; 9+ messages in thread
From: Miaohe Lin @ 2022-10-29  2:35 UTC (permalink / raw)
  To: Peter Xu, linux-kernel, linux-mm
  Cc: Huang Ying, Andrew Morton, HORIGUCHI NAOYA, David Hildenbrand,
	Andrea Arcangeli

On 2022/10/25 4:48, Peter Xu wrote:
> The PTE markers code is tiny and now it's enabled for most of the
> distributions.  It's fine to keep it as-is, but to make a broader use of
> it (e.g. replacing read error swap entry) it needs to be there always
> otherwise we need special code path to take care of !PTE_MARKER case.
> 
> It'll be easier just make pte marker always exist.  Use this chance to
> extend its usage to anonymous too by simply touching up some of the old
> comments, because it'll be used for anonymous pages in the follow up
> patches.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>

Many thanks for your work.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks,
Miaohe Lin




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

* Re: [PATCH RFC 2/2] mm: Use pte markers for swap errors
  2022-10-24 20:48 ` [PATCH RFC 2/2] mm: Use pte markers for swap errors Peter Xu
  2022-10-25 15:31   ` David Hildenbrand
@ 2022-10-29  2:49   ` Miaohe Lin
  1 sibling, 0 replies; 9+ messages in thread
From: Miaohe Lin @ 2022-10-29  2:49 UTC (permalink / raw)
  To: Peter Xu, linux-kernel, linux-mm
  Cc: Huang Ying, Andrew Morton, HORIGUCHI NAOYA, David Hildenbrand,
	Andrea Arcangeli

On 2022/10/25 4:48, Peter Xu wrote:
> PTE markers are ideal mechanism for things like SWP_SWAPIN_ERROR.  Using a
> whole swap entry type for this purpose can be an overkill, especially if we
> already have PTE markers.  Define a new bit for swapin error and replace it
> with pte markers.  Then we can safely drop SWP_SWAPIN_ERROR and give one
> device slot back to swap.
> 
> We used to have SWP_SWAPIN_ERROR taking the page pfn as part of the swap
> entry, but it's never used.  Neither do I see how it can be useful because
> normally the swapin failure should not be caused by a bad page but bad swap
> device.  Drop it alongside.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>

Thanks for doing this. I have been waiting this for a "long" time. ;)
With changing the name of PTE_MARKER_SWAP_ERROR proposed by David, this
patch looks good to me.

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks,
Miaohe Lin



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

end of thread, other threads:[~2022-10-29  2:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 20:48 [PATCH RFC 0/2] mm: Use pte marker for swapin errors Peter Xu
2022-10-24 20:48 ` [PATCH RFC 1/2] mm: Always compile in pte markers Peter Xu
2022-10-29  2:35   ` Miaohe Lin
2022-10-24 20:48 ` [PATCH RFC 2/2] mm: Use pte markers for swap errors Peter Xu
2022-10-25 15:31   ` David Hildenbrand
2022-10-25 15:44     ` Peter Xu
2022-10-29  2:49   ` Miaohe Lin
2022-10-25  3:01 ` [PATCH RFC 0/2] mm: Use pte marker for swapin errors Huang, Ying
2022-10-25 15:08   ` Peter Xu

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).