2021-08-10 20:31:14

by Yang Shi

[permalink] [raw]
Subject: [PATCH 3/3] Revert "mm: swap: check if swap backing device is congested or not"

Due to the change about how block layer detects congestion the
justification of commit 8fd2e0b505d1 ("mm: swap: check if swap backing device
is congested or not") doesn't stand anymore, so the commit could be just
reverted in order to solve the race reported by commit 2efa33fc7f6e ("mm/shmem:
fix shmem_swapin() race with swapoff"). The fix was reverted by the
previous patch.

Suggested-by: Hugh Dickins <[email protected]>
Cc: "Huang, Ying" <[email protected]>
Cc: Miaohe Lin <[email protected]>
Signed-off-by: Yang Shi <[email protected]>
---
mm/swap_state.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/mm/swap_state.c b/mm/swap_state.c
index 1a29b4f98208..8d4104242100 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -628,13 +628,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask,
if (!mask)
goto skip;

- /* Test swap type to make sure the dereference is safe */
- if (likely(si->flags & (SWP_BLKDEV | SWP_FS_OPS))) {
- struct inode *inode = si->swap_file->f_mapping->host;
- if (inode_read_congested(inode))
- goto skip;
- }
-
do_poll = false;
/* Read a page_cluster sized and aligned cluster around offset. */
start_offset = offset & ~mask;
--
2.26.2


2021-08-10 21:10:07

by Hugh Dickins

[permalink] [raw]
Subject: Re: [PATCH 3/3] Revert "mm: swap: check if swap backing device is congested or not"

On Tue, 10 Aug 2021, Yang Shi wrote:

> Due to the change about how block layer detects congestion the
> justification of commit 8fd2e0b505d1 ("mm: swap: check if swap backing device
> is congested or not") doesn't stand anymore, so the commit could be just
> reverted in order to solve the race reported by commit 2efa33fc7f6e ("mm/shmem:
> fix shmem_swapin() race with swapoff"). The fix was reverted by the
> previous patch.
>
> Suggested-by: Hugh Dickins <[email protected]>
> Cc: "Huang, Ying" <[email protected]>
> Cc: Miaohe Lin <[email protected]>
> Signed-off-by: Yang Shi <[email protected]>

Thanks for doing these,
Acked-by: Hugh Dickins <[email protected]>
to all three.

I guess 1/3 will vanish now, since what it's reverting has not yet gone
forward to Linus: it would have been nice for 2/3 to have mentioned that
what it's reverting is kindof buggy: but then you'd have to explain the
"kindof", and that takes more words than it's worth - maybe a lore Link
to the discussion?

But you've done the work that I've not yet got around to:
so thank you, and ignore my gripes.

Hugh

> ---
> mm/swap_state.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index 1a29b4f98208..8d4104242100 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -628,13 +628,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask,
> if (!mask)
> goto skip;
>
> - /* Test swap type to make sure the dereference is safe */
> - if (likely(si->flags & (SWP_BLKDEV | SWP_FS_OPS))) {
> - struct inode *inode = si->swap_file->f_mapping->host;
> - if (inode_read_congested(inode))
> - goto skip;
> - }
> -
> do_poll = false;
> /* Read a page_cluster sized and aligned cluster around offset. */
> start_offset = offset & ~mask;
> --
> 2.26.2

2021-08-10 21:32:53

by Yang Shi

[permalink] [raw]
Subject: Re: [PATCH 3/3] Revert "mm: swap: check if swap backing device is congested or not"

On Tue, Aug 10, 2021 at 2:08 PM Hugh Dickins <[email protected]> wrote:
>
> On Tue, 10 Aug 2021, Yang Shi wrote:
>
> > Due to the change about how block layer detects congestion the
> > justification of commit 8fd2e0b505d1 ("mm: swap: check if swap backing device
> > is congested or not") doesn't stand anymore, so the commit could be just
> > reverted in order to solve the race reported by commit 2efa33fc7f6e ("mm/shmem:
> > fix shmem_swapin() race with swapoff"). The fix was reverted by the
> > previous patch.
> >
> > Suggested-by: Hugh Dickins <[email protected]>
> > Cc: "Huang, Ying" <[email protected]>
> > Cc: Miaohe Lin <[email protected]>
> > Signed-off-by: Yang Shi <[email protected]>
>
> Thanks for doing these,
> Acked-by: Hugh Dickins <[email protected]>
> to all three.
>
> I guess 1/3 will vanish now, since what it's reverting has not yet gone
> forward to Linus: it would have been nice for 2/3 to have mentioned that
> what it's reverting is kindof buggy: but then you'd have to explain the
> "kindof", and that takes more words than it's worth - maybe a lore Link
> to the discussion?

It is fine, I think this one is the best elaborated the problem:
https://lore.kernel.org/linux-mm/[email protected]/

>
> But you've done the work that I've not yet got around to:
> so thank you, and ignore my gripes.
>
> Hugh
>
> > ---
> > mm/swap_state.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/mm/swap_state.c b/mm/swap_state.c
> > index 1a29b4f98208..8d4104242100 100644
> > --- a/mm/swap_state.c
> > +++ b/mm/swap_state.c
> > @@ -628,13 +628,6 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask,
> > if (!mask)
> > goto skip;
> >
> > - /* Test swap type to make sure the dereference is safe */
> > - if (likely(si->flags & (SWP_BLKDEV | SWP_FS_OPS))) {
> > - struct inode *inode = si->swap_file->f_mapping->host;
> > - if (inode_read_congested(inode))
> > - goto skip;
> > - }
> > -
> > do_poll = false;
> > /* Read a page_cluster sized and aligned cluster around offset. */
> > start_offset = offset & ~mask;
> > --
> > 2.26.2

2021-08-10 21:59:40

by Hugh Dickins

[permalink] [raw]
Subject: Re: [PATCH 3/3] Revert "mm: swap: check if swap backing device is congested or not"

On Tue, 10 Aug 2021, Yang Shi wrote:
> On Tue, Aug 10, 2021 at 2:08 PM Hugh Dickins <[email protected]> wrote:
> >
> > I guess 1/3 will vanish now, since what it's reverting has not yet gone
> > forward to Linus: it would have been nice for 2/3 to have mentioned that
> > what it's reverting is kindof buggy: but then you'd have to explain the
> > "kindof", and that takes more words than it's worth - maybe a lore Link
> > to the discussion?
>
> It is fine, I think this one is the best elaborated the problem:
> https://lore.kernel.org/linux-mm/[email protected]/

Yes, that best elaborated the problem when I thought it was a problem, then
https://lore.kernel.org/linux-mm/[email protected]/
explained why I later came to think that it wasn't a problem after all.

Hence "kindof" buggy: but good to be reverted anyway.

Whatever!
Thanks,
Hugh