[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3a0e874-7035-4505-812b-60acc5fc2032@suse.cz>
Date: Fri, 21 Mar 2025 16:09:33 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Gavin Shan <gshan@...hat.com>, linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
willy@...radead.org, david@...hat.com, linmiaohe@...wei.com,
gehao@...inos.cn, shan.gavin@...il.com
Subject: Re: [PATCH v2 1/2] mm: Fix parameter passed to
page_mapcount_is_type()
On 3/21/25 13:02, Gavin Shan wrote:
> As the comments of page_mapcount_is_type() indicate, the parameter
> passed to the function should be one more than page->_mapcount.
> However, page->_mapcount (equivalent to page->page_type) is passed
> to the function by commit 4ffca5a96678 ("mm: support only one page_type
> per page") page_type_has_type() is replaced by page_mapcount_is_type(),
> but the parameter isn't adjusted.
>
> Fix it by replacing page_mapcount_is_type() with page_type_has_type()
> in page_has_type(). Note that the issue doesn't cause any visible impacts
> due to the safety gap introduced by PGTY_mapcount_underflow limit.
>
> Fixes: 4ffca5a96678 ("mm: support only one page_type per page")
> Signed-off-by: Gavin Shan <gshan@...hat.com>
> Acked-by: David Hildenbrand <david@...hat.com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
> ---
> include/linux/page-flags.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index 36d283552f80..e1a9f84bd5ab 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -950,7 +950,7 @@ static inline bool page_mapcount_is_type(unsigned int mapcount)
>
> static inline bool page_has_type(const struct page *page)
> {
> - return page_mapcount_is_type(data_race(page->page_type));
> + return page_type_has_type(data_race(page->page_type));
> }
>
> #define FOLIO_TYPE_OPS(lname, fname) \
Powered by blists - more mailing lists