mbox series

[0/2] mm: Use pte marker for swapin errors

Message ID 20221030214151.402274-1-peterx@redhat.com (mailing list archive)
Headers show
Series mm: Use pte marker for swapin errors | expand

Message

Peter Xu Oct. 30, 2022, 9:41 p.m. UTC
rfc->v1:
- Rename SWAP_ERROR -> SWAPIN_ERROR [David, Miaohe]
- Added r-bs for Ying and Miaohe

Hi,

This series uses the pte marker to replace the swapin error swap entry,
then we save one more swap entry slot for swap devices.  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(-)

Comments

Huang, Ying Oct. 31, 2022, 1:40 a.m. UTC | #1
Peter Xu <peterx@redhat.com> writes:

> rfc->v1:
> - Rename SWAP_ERROR -> SWAPIN_ERROR [David, Miaohe]
> - Added r-bs for Ying and Miaohe
>
> Hi,
>
> This series uses the pte marker to replace the swapin error swap entry,
> then we save one more swap entry slot for swap devices.  A new pte marker
> bit is defined.

Per my understanding, "swap entry" describes one swap page (4KB on x86)
in one swap device.  So, the original swapin error implementation uses
one swap file (or swap device) instead of one swap entry.  So your patch
saves one swap file (or swap device).

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(-)
Peter Xu Oct. 31, 2022, 2:14 p.m. UTC | #2
On Mon, Oct 31, 2022 at 09:40:15AM +0800, Huang, Ying wrote:
> Peter Xu <peterx@redhat.com> writes:
> 
> > rfc->v1:
> > - Rename SWAP_ERROR -> SWAPIN_ERROR [David, Miaohe]
> > - Added r-bs for Ying and Miaohe
> >
> > Hi,
> >
> > This series uses the pte marker to replace the swapin error swap entry,
> > then we save one more swap entry slot for swap devices.  A new pte marker
> > bit is defined.
> 
> Per my understanding, "swap entry" describes one swap page (4KB on x86)
> in one swap device.  So, the original swapin error implementation uses
> one swap file (or swap device) instead of one swap entry.  So your patch
> saves one swap file (or swap device).

Yeah I was definitely not accurate enough, I wanted to use "slot" to mean
"type" here but obviously I didn't make it, sorry.  Hopefully the whole
patchset is still clear enough anyway so no reader will get confused by it.
Huang, Ying Nov. 1, 2022, 5:05 a.m. UTC | #3
Peter Xu <peterx@redhat.com> writes:

> On Mon, Oct 31, 2022 at 09:40:15AM +0800, Huang, Ying wrote:
>> Peter Xu <peterx@redhat.com> writes:
>> 
>> > rfc->v1:
>> > - Rename SWAP_ERROR -> SWAPIN_ERROR [David, Miaohe]
>> > - Added r-bs for Ying and Miaohe
>> >
>> > Hi,
>> >
>> > This series uses the pte marker to replace the swapin error swap entry,
>> > then we save one more swap entry slot for swap devices.  A new pte marker
>> > bit is defined.
>> 
>> Per my understanding, "swap entry" describes one swap page (4KB on x86)
>> in one swap device.  So, the original swapin error implementation uses
>> one swap file (or swap device) instead of one swap entry.  So your patch
>> saves one swap file (or swap device).
>
> Yeah I was definitely not accurate enough, I wanted to use "slot" to mean
> "type" here but obviously I didn't make it, sorry.  Hopefully the whole
> patchset is still clear enough anyway so no reader will get confused by it.

The terminology used in swap code is a little complex.  The swap slot is
used to describe swap entry (swap page) too in swap slots cache
(swap_slots.c/h).

Best Regards,
Huang, Ying