[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240307200826.GE9179@nvidia.com>
Date: Thu, 7 Mar 2024 16:08:26 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: peterx@...hat.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <muchun.song@...ux.dev>,
Matthew Wilcox <willy@...radead.org>,
Mike Rapoport <rppt@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>, x86@...nel.org,
sparclinux@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH RFC 03/13] mm/gup: Check p4d presence before going on
On Wed, Mar 06, 2024 at 06:41:37PM +0800, peterx@...hat.com wrote:
> From: Peter Xu <peterx@...hat.com>
>
> Currently there should have no p4d swap entries so it may not matter much,
> however this may help us to rule out swap entries in pXd_huge() API, which
> will include p4d_huge(). The p4d_present() checks make it 100% clear that
> we won't rely on p4d_huge() for swap entries.
>
> Signed-off-by: Peter Xu <peterx@...hat.com>
> ---
> mm/gup.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> p4dp = p4d_offset(pgdp, address);
> p4d = READ_ONCE(*p4dp);
> - if (p4d_none(p4d))
> + if (p4d_none(p4d) || !p4d_present(p4d))
> return no_page_table(vma, flags);
Like the other place I think this makes more sense as
if (!p4_present(p4d))
return no_page_table(vma, flags);
Since none can never be present.
IOW if the following code doesn't decode swap entries then it should
be guarded with a chceck on present not none..
Jason
Powered by blists - more mailing lists