linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve migration by backing off earlier
@ 2024-08-09 10:31 Dev Jain
  2024-08-09 10:31 ` [PATCH 1/2] mm: Retry migration earlier upon refcount mismatch Dev Jain
  2024-08-09 10:31 ` [PATCH 2/2] selftests/mm: Do not fail test for a single migration failure Dev Jain
  0 siblings, 2 replies; 30+ messages in thread
From: Dev Jain @ 2024-08-09 10:31 UTC (permalink / raw)
  To: akpm, shuah, david, willy
  Cc: ryan.roberts, anshuman.khandual, catalin.marinas, cl, vbabka,
	mhocko, apopple, osalvador, baolin.wang, dave.hansen, will,
	baohua, ioworker0, gshan, mark.rutland, kirill.shutemov, hughd,
	aneesh.kumar, yang, peterx, broonie, mgorman, linux-arm-kernel,
	linux-kernel, linux-mm, linux-kselftest, Dev Jain

It was recently observed at [1] that during the folio unmapping stage
of migration, when the PTEs are cleared, a racing thread faulting on that
folio may increase the refcount of the folio, sleep on the folio lock
(the migration path has the lock), and migration ultimately fails
when asserting the actual refcount against the expected.

Migration is a best effort service; the unmapping and the moving phase
are wrapped around loops for retrying. The refcount of the folio is
currently being asserted during the move stage; if it fails, we retry.
But, if a racing thread changes the refcount, and ends up sleeping on the
folio lock (which is mostly the case), there is no way the refcount would
be decremented; as a result, this renders the retrying useless. In the
first patch, we make the refcount check also during the unmap stage; if
it fails, we restore the original state of the PTE, drop the folio lock,
let the system make progress, and retry unmapping again. This improves the
probability of migration winning the race.

Given that migration is a best-effort service, it is wrong to fail the
test for just a single failure; hence, fail the test after 100 consecutive
failures (where 100 is still a subjective choice).

[1] https://lore.kernel.org/all/20240801081657.1386743-1-dev.jain@arm.com/

Dev Jain (2):
  mm: Retry migration earlier upon refcount mismatch
  selftests/mm: Do not fail test for a single migration failure

 mm/migrate.c                           |  9 +++++++++
 tools/testing/selftests/mm/migration.c | 17 +++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

-- 
2.30.2



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

end of thread, other threads:[~2024-09-02  6:46 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 10:31 [PATCH 0/2] Improve migration by backing off earlier Dev Jain
2024-08-09 10:31 ` [PATCH 1/2] mm: Retry migration earlier upon refcount mismatch Dev Jain
2024-08-09 13:47   ` David Hildenbrand
2024-08-09 21:09     ` Christoph Lameter (Ampere)
2024-08-10 18:42     ` Dev Jain
2024-08-10 18:52       ` David Hildenbrand
2024-08-11  6:06         ` Dev Jain
2024-08-11  9:08           ` David Hildenbrand
2024-08-12  5:35             ` Dev Jain
2024-08-12  9:30               ` David Hildenbrand
2024-08-10 21:05     ` Zi Yan
2024-08-12  5:34   ` Huang, Ying
2024-08-12  6:01     ` Dev Jain
2024-08-12  6:15       ` Huang, Ying
2024-08-12  6:52         ` Dev Jain
2024-08-12  7:31           ` Huang, Ying
2024-08-12 12:08             ` Dev Jain
2024-08-13  5:00               ` Dev Jain
2024-08-13  7:22                 ` Dev Jain
2024-08-16 11:31                   ` Dev Jain
2024-08-19  6:58                     ` Huang, Ying
2024-08-20  7:16                       ` Dev Jain
2024-09-02  6:42                         ` Huang, Ying
2024-08-12  6:13     ` Dev Jain
2024-08-12  6:20       ` Huang, Ying
2024-08-12  6:32         ` Dev Jain
2024-08-09 10:31 ` [PATCH 2/2] selftests/mm: Do not fail test for a single migration failure Dev Jain
2024-08-09 17:13   ` Shuah Khan
2024-08-09 21:10     ` Christoph Lameter (Ampere)
2024-08-12  6:19     ` Dev Jain

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