Linux-RDMA Archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Alistair Popple <apopple@nvidia.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rdma@vger.kernel.org, linux-mm@kvack.org,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Leon Romanovsky <leon@kernel.org>,
	Artemy Kovalyov <artemyko@nvidia.com>,
	Michael Guralnik <michaelgur@nvidia.com>,
	Pak Markthub <pmarkthub@nvidia.com>
Subject: Re: [RFC] RDMA/umem: pin_user_pages*() can temporarily fail due to migration glitches
Date: Wed, 1 May 2024 23:49:48 -0700	[thread overview]
Message-ID: <79a63282-867f-41d9-988e-ff6ae70d3d9b@nvidia.com> (raw)
In-Reply-To: <87r0el3tfi.fsf@nvdebian.thelocal>

On 5/1/24 6:05 PM, Alistair Popple wrote:
> Jason Gunthorpe <jgg@nvidia.com> writes:
>> On Tue, Apr 30, 2024 at 10:10:43PM -0700, Christoph Hellwig wrote:
...
>>> This doesn't make sense.  IFF a blind retry is all that is needed it
>>> should be done in the core functionality.  I fear it's not that easy,
>>> though.
>>
>> +1
>>
>> This migration retry weirdness is a GUP issue, it needs to be solved
>> in the mm not exposed to every pin_user_pages caller.
>>
>> If it turns out ZONE_MOVEABLE pages can't actually be reliably moved
>> then it is pretty broken..
> 
> I wonder if we should remove the arbitrary retry limit in
> migrate_pages() entirely for ZONE_MOVEABLE pages and just loop until
> they migrate? By definition there should only be transient references on
> these pages so why do we need to limit the number of retries in the
> first place?
> 

Well, along those lines, I can confirm that this patch also fixes the
symptoms:

diff --git a/mm/migrate.c b/mm/migrate.c
index 73a052a382f1..faa67cc441e2 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1728,7 +1728,9 @@ static int migrate_pages_batch(struct list_head *from,
  				else
  					goto move;
  			case -EAGAIN:
-				retry++;
+				/* For ZONE_MOVABLE folios, retry forever */
+				if (!folio_is_zone_movable(folio))
+					retry++;
  				thp_retry += is_thp;
  				nr_retry_pages += nr_pages;
  				break;
@@ -1786,7 +1788,9 @@ static int migrate_pages_batch(struct list_head *from,
  			 */
  			switch(rc) {
  			case -EAGAIN:
-				retry++;
+				/* For ZONE_MOVABLE folios, retry forever */
+				if (!folio_is_zone_movable(folio))
+					retry++;
  				thp_retry += is_thp;
  				nr_retry_pages += nr_pages;
  				break;

thanks,
-- 
John Hubbard
NVIDIA


  reply	other threads:[~2024-05-02  6:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01  0:31 [RFC] RDMA/umem: pin_user_pages*() can temporarily fail due to migration glitches John Hubbard
2024-05-01  5:10 ` Christoph Hellwig
2024-05-01 12:10   ` Jason Gunthorpe
2024-05-01 17:32     ` John Hubbard
2024-05-02  1:05     ` Alistair Popple
2024-05-02  6:49       ` John Hubbard [this message]
2024-05-02  6:56       ` David Hildenbrand
2024-05-02 18:10         ` John Hubbard
2024-05-02 18:34           ` Jason Gunthorpe
2024-05-02 18:44             ` Matthew Wilcox
2024-05-10  7:54           ` David Hildenbrand
2024-05-11  0:32             ` Kasireddy, Vivek

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=79a63282-867f-41d9-988e-ff6ae70d3d9b@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=artemyko@nvidia.com \
    --cc=hch@infradead.org \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@nvidia.com \
    --cc=mike.marciniszyn@intel.com \
    --cc=pmarkthub@nvidia.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).