From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alistair Popple <apopple@nvidia.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
steve.kang@unisoc.com
Subject: Re: [PATCH] mm: gup: fix infinite loop within __get_longterm_locked
Date: Tue, 21 Jan 2025 09:28:49 +0800 [thread overview]
Message-ID: <CAGWkznEWmJU9q8d2x29HSU9wU3ue6MdaM1tVn-u=OiYOW5M9Qg@mail.gmail.com> (raw)
In-Reply-To: <625d91cc-59f3-4757-81df-220d32861493@nvidia.com>
On Tue, Jan 21, 2025 at 3:34 AM John Hubbard <jhubbard@nvidia.com> wrote:
>
> On 1/20/25 1:26 AM, zhaoyang.huang wrote:
> > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> >
> > Infinite loop within __get_longterm_locked detected in an unique usage
> > of pin_user_pages where the VA's pages are all unpinnable(vm_ops->fault
> > function allocate pages via cma_alloc for hardware purpose and leave them
> > out of LRU). Fixing this by have 'collected' reflect the actual number
> > of pages in movable_folio_list.
>
> The above is rather terse, although perhaps by kernel standards it's OK.
>
> Isn't this missing a Fixes tag?
>
> Fixes: 67e139b02d994 ("mm/gup.c: refactor
> check_and_migrate_movable_pages()")
ok. will amend in v2
>
> >
> > Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > ---
> > mm/gup.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/gup.c b/mm/gup.c
> > index 3b75e631f369..2231ce7221f9 100644
> > --- a/mm/gup.c
> > +++ b/mm/gup.c
> > @@ -2341,8 +2341,6 @@ static unsigned long collect_longterm_unpinnable_folios(
> > if (folio_is_longterm_pinnable(folio))
> > continue;
> >
> > - collected++;
> > -
> > if (folio_is_device_coherent(folio))
> > continue;
> >
> > @@ -2359,6 +2357,8 @@ static unsigned long collect_longterm_unpinnable_folios(
> > if (!folio_isolate_lru(folio))
> > continue;
> >
> > + collected++;
> > +
>
> Well, this seems correct to me. Somehow I talked myself into believing
> that it was OK to do collected++ early, even though later on we skip
> actually collecting the folio, thus miscounting things.
>
> But now I believe it was just incorrect all along.
>
>
> Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks
>
> thanks,
> --
> John Hubbard
next prev parent reply other threads:[~2025-01-21 1:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 9:26 zhaoyang.huang
2025-01-20 19:34 ` John Hubbard
2025-01-21 1:28 ` Zhaoyang Huang [this message]
2025-01-20 20:14 ` David Hildenbrand
2025-01-21 1:31 ` Zhaoyang Huang
2025-01-21 7:49 ` David Hildenbrand
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='CAGWkznEWmJU9q8d2x29HSU9wU3ue6MdaM1tVn-u=OiYOW5M9Qg@mail.gmail.com' \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=steve.kang@unisoc.com \
--cc=zhaoyang.huang@unisoc.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