From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Matthew Wilcox <willy@infradead.org>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Ke Wang <ke.wang@unisoc.com>
Subject: Re: [PATCH 1/2] mm: fix logic error of page_expected_state
Date: Wed, 14 Sep 2022 12:35:31 +0800 [thread overview]
Message-ID: <CAGWkznFYa26GeAPU+FNxrX1EJ3bLz+q8drtpuO4mNYFGtLG_Ww@mail.gmail.com> (raw)
In-Reply-To: <1663126621-26926-1-git-send-email-zhaoyang.huang@unisoc.com>
On Wed, Sep 14, 2022 at 11:37 AM zhaoyang.huang
<zhaoyang.huang@unisoc.com> wrote:
>
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> The page with special page type will be deemed as bad page wrongly since
> type share the same address with mapcount.
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
> include/linux/page-flags.h | 4 ++--
> mm/page_alloc.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> index e66f7aa..5d3274b 100644
> --- a/include/linux/page-flags.h
> +++ b/include/linux/page-flags.h
> @@ -946,9 +946,9 @@ static inline bool is_page_hwpoison(struct page *page)
> #define PageType(page, flag) \
> ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)
>
> -static inline int page_has_type(struct page *page)
> +static inline bool page_has_type(struct page *page)
> {
> - return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
> + return (int)page->page_type < PAGE_MAPCOUNT_RESERVE;
amend the type conversion
> }
>
> #define PAGE_TYPE_OPS(uname, lname) \
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e008a3d..3714680 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1164,7 +1164,7 @@ int split_free_page(struct page *free_page,
> static inline bool page_expected_state(struct page *page,
> unsigned long check_flags)
> {
> - if (unlikely(atomic_read(&page->_mapcount) != -1))
> + if (unlikely(!page_has_type(page) && atomic_read(&page->_mapcount) != -1))
> return false;
>
> if (unlikely((unsigned long)page->mapping |
> --
> 1.9.1
>
next prev parent reply other threads:[~2022-09-14 4:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 3:37 zhaoyang.huang
2022-09-14 3:37 ` [PATCH 2/2] mm: introduce __GFP_TRACKLEAK to track in-kernel allocation zhaoyang.huang
2022-09-14 8:26 ` Matthew Wilcox
2022-09-14 4:35 ` Zhaoyang Huang [this message]
2022-09-14 7:35 ` [PATCH 1/2] mm: fix logic error of page_expected_state Matthew Wilcox
2022-09-14 8:14 ` Zhaoyang Huang
2022-09-14 10:51 ` Zhaoyang Huang
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=CAGWkznFYa26GeAPU+FNxrX1EJ3bLz+q8drtpuO4mNYFGtLG_Ww@mail.gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--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