From: Alistair Popple <apopple@nvidia.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Yang Shi <shy828301@gmail.com>,
Wang Yugui <wangyugui@e16-tech.com>,
Matthew Wilcox <willy@infradead.org>,
"Ralph Campbell" <rcampbell@nvidia.com>, Zi Yan <ziy@nvidia.com>,
Peter Xu <peterx@redhat.com>, Will Deacon <will@kernel.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 01/11] mm: page_vma_mapped_walk(): use page for pvmw->page
Date: Thu, 10 Jun 2021 18:12:40 +1000 [thread overview]
Message-ID: <3489192.qTgHbfadoh@nvdebian> (raw)
In-Reply-To: <88e67645-f467-c279-bf5e-af4b5c6b13eb@google.com>
Thanks for this, I've read through page_vma_mapped_walk() a few too many times
recently and it annoyed me enough to start writing some patches to clean it up,
but happy to see this instead.
I confirmed pvmw->page isn't modified here or in map/check_pte(pvmw), so the
patch looks good to me:
Reviewed-by: Alistair Popple <apopple@nvidia.com>
On Thursday, 10 June 2021 4:34:40 PM AEST Hugh Dickins wrote:
> page_vma_mapped_walk() cleanup: sometimes the local copy of pvwm->page was
> used, sometimes pvmw->page itself: use the local copy "page" throughout.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> Cc: <stable@vger.kernel.org>
> ---
> mm/page_vma_mapped.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
> index e37bd43904af..a6dbf714ca15 100644
> --- a/mm/page_vma_mapped.c
> +++ b/mm/page_vma_mapped.c
> @@ -156,7 +156,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> if (pvmw->pte)
> goto next_pte;
>
> - if (unlikely(PageHuge(pvmw->page))) {
> + if (unlikely(PageHuge(page))) {
> /* when pud is not present, pte will be NULL */
> pvmw->pte = huge_pte_offset(mm, pvmw->address, page_size(page));
> if (!pvmw->pte)
> @@ -217,8 +217,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> * cannot return prematurely, while zap_huge_pmd() has
> * cleared *pmd but not decremented compound_mapcount().
> */
> - if ((pvmw->flags & PVMW_SYNC) &&
> - PageTransCompound(pvmw->page)) {
> + if ((pvmw->flags & PVMW_SYNC) && PageTransCompound(page)) {
> spinlock_t *ptl = pmd_lock(mm, pvmw->pmd);
>
> spin_unlock(ptl);
> @@ -234,9 +233,9 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> return true;
> next_pte:
> /* Seek to next pte only makes sense for THP */
> - if (!PageTransHuge(pvmw->page) || PageHuge(pvmw->page))
> + if (!PageTransHuge(page) || PageHuge(page))
> return not_found(pvmw);
> - end = vma_address_end(pvmw->page, pvmw->vma);
> + end = vma_address_end(page, pvmw->vma);
> do {
> pvmw->address += PAGE_SIZE;
> if (pvmw->address >= end)
> --
> 2.26.2
>
next prev parent reply other threads:[~2021-06-10 8:12 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 6:31 [PATCH 00/11] mm: page_vma_mapped_walk() cleanup and THP fixes Hugh Dickins
2021-06-10 6:34 ` [PATCH 01/11] mm: page_vma_mapped_walk(): use page for pvmw->page Hugh Dickins
2021-06-10 8:12 ` Alistair Popple [this message]
2021-06-10 8:55 ` Kirill A. Shutemov
2021-06-10 14:14 ` Peter Xu
2021-06-10 6:36 ` [PATCH 02/11] mm: page_vma_mapped_walk(): settle PageHuge on entry Hugh Dickins
2021-06-10 8:57 ` Kirill A. Shutemov
2021-06-10 14:17 ` Peter Xu
2021-06-10 6:38 ` [PATCH 03/11] mm: page_vma_mapped_walk(): use pmd_read_atomic() Hugh Dickins
2021-06-10 9:06 ` Kirill A. Shutemov
2021-06-10 12:15 ` Jason Gunthorpe
[not found] ` <aebb6b96-153e-7d7-59da-f6bad4337aa7@google.com>
2021-06-11 15:36 ` Jason Gunthorpe
2021-06-11 19:05 ` Hugh Dickins
2021-06-11 19:42 ` Jason Gunthorpe
2021-06-15 9:46 ` Will Deacon
2021-06-16 0:42 ` Jason Gunthorpe
2021-06-16 10:27 ` Will Deacon
2021-06-11 19:33 ` Hugh Dickins
2021-06-10 6:40 ` [PATCH 04/11] mm: page_vma_mapped_walk(): use pmde for *pvmw->pmd Hugh Dickins
2021-06-10 9:10 ` Kirill A. Shutemov
2021-06-10 14:31 ` Peter Xu
2021-06-10 6:42 ` [PATCH 05/11] mm: page_vma_mapped_walk(): prettify PVMW_MIGRATION block Hugh Dickins
2021-06-10 9:16 ` Kirill A. Shutemov
2021-06-10 14:48 ` Peter Xu
2021-06-10 6:44 ` [PATCH 06/11] mm: page_vma_mapped_walk(): crossing page table boundary Hugh Dickins
2021-06-10 9:32 ` Kirill A. Shutemov
2021-06-10 6:46 ` [PATCH 07/11] mm: page_vma_mapped_walk(): add a level of indentation Hugh Dickins
2021-06-10 9:34 ` Kirill A. Shutemov
2021-06-10 6:48 ` [PATCH 08/11] mm: page_vma_mapped_walk(): use goto instead of while (1) Hugh Dickins
2021-06-10 9:39 ` Kirill A. Shutemov
2021-06-10 6:50 ` [PATCH 09/11] mm: page_vma_mapped_walk(): get vma_address_end() earlier Hugh Dickins
2021-06-10 9:40 ` Kirill A. Shutemov
2021-06-10 6:52 ` [PATCH 10/11] mm/thp: fix page_vma_mapped_walk() if THP mapped by ptes Hugh Dickins
2021-06-10 9:42 ` Kirill A. Shutemov
2021-06-10 6:54 ` [PATCH 11/11] mm/thp: another PVMW_SYNC fix in page_vma_mapped_walk() Hugh Dickins
2021-06-10 9:43 ` Kirill A. Shutemov
2021-06-11 18:29 ` Hugh Dickins
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=3489192.qTgHbfadoh@nvdebian \
--to=apopple@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=rcampbell@nvidia.com \
--cc=shy828301@gmail.com \
--cc=wangyugui@e16-tech.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=ziy@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 NNTP newsgroup(s).