linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Charan Teja Kalla <quic_charante@quicinc.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <akpm@linux-foundation.org>, <david@redhat.com>,
	<hannes@cmpxchg.org>, <kirill.shutemov@linux.intel.com>,
	<shakeelb@google.com>, <n-horiguchi@ah.jp.nec.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [RFC] mm: migrate: rcu stalls because of invalid swap cache entries
Date: Thu, 23 Nov 2023 19:55:53 +0530	[thread overview]
Message-ID: <51f727a2-75e9-d42f-bae6-d3e4c3328af1@quicinc.com> (raw)
In-Reply-To: <ZVzXLu4Ds+3aQtGm@casper.infradead.org>

Thanks Matthew!

On 11/21/2023 9:43 PM, Matthew Wilcox wrote:
> What would you think to this?  I think a better fix would be to
> fix the swap cache to user multi-order entries, but I would like to
> see this backportable!
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index d9d2b9432e81..2d67ca47d2e2 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -405,6 +405,7 @@ int folio_migrate_mapping(struct address_space *mapping,
>  	int dirty;
>  	int expected_count = folio_expected_refs(mapping, folio) + extra_count;
>  	long nr = folio_nr_pages(folio);
> +	long entries, i;
>  
>  	if (!mapping) {
>  		/* Anonymous page without mapping */
> @@ -442,8 +443,10 @@ int folio_migrate_mapping(struct address_space *mapping,
>  			folio_set_swapcache(newfolio);
>  			newfolio->private = folio_get_private(folio);
>  		}
> +		entries = nr;
>  	} else {
>  		VM_BUG_ON_FOLIO(folio_test_swapcache(folio), folio);
> +		entries = 1;
>  	}
>  
>  	/* Move dirty while page refs frozen and newpage not yet exposed */
> @@ -453,7 +456,11 @@ int folio_migrate_mapping(struct address_space *mapping,
>  		folio_set_dirty(newfolio);
>  	}
>  
> -	xas_store(&xas, newfolio);
> +	/* Swap cache still stores N entries instead of a high-order entry */
> +	for (i = 0; i < entries; i++) {
> +		xas_store(&xas, newfolio);
> +		xas_next(&xas);
> +	}
>  
>  	/*
>  	 * Drop cache reference from old page by unfreezing
Seems a cleaner one to store N entries. Supporting swap cache for multi
order entries might be time consuming. Till then, can we use this patch
as the solution, with the proper commit log conveying revert of this
patch when swap cache supported with Multi-order indices?

Please Lmk, If I can raise this patch with suggested-by:you .

Thanks
Charan



  reply	other threads:[~2023-11-23 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 12:30 Charan Teja Kalla
2023-11-21 16:13 ` Matthew Wilcox
2023-11-23 14:25   ` Charan Teja Kalla [this message]
2023-12-13 13:57     ` Charan Teja Kalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51f727a2-75e9-d42f-bae6-d3e4c3328af1@quicinc.com \
    --to=quic_charante@quicinc.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=shakeelb@google.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox