[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220330182918.38276a89@gandalf.local.home>
Date: Wed, 30 Mar 2022 18:29:18 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Zi Yan <zi.yan@...t.com>
Cc: Zi Yan <ziy@...dia.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mel Gorman <mgorman@...hsingularity.net>,
Mike Rapoport <rppt@...nel.org>,
Oscar Salvador <osalvador@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: page_alloc: validate buddy before check its
migratetype.
On Wed, 30 Mar 2022 18:12:38 -0400
Zi Yan <zi.yan@...t.com> wrote:
> From: Zi Yan <ziy@...dia.com>
>
> Whenever a buddy page is found, page_is_buddy() should be called to
> check its validity. Add the missing check during pageblock merge check.
>
> Fixes: 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable pageblocks with others")
Link: https://lore.kernel.org/all/20220330154208.71aca532@gandalf.local.home/
>
> Reported-by: Steven Rostedt <rostedt@...dmis.org>
Tested-by: Steven Rostedt (Google) <rostedt@...dmis.org>
-- Steve
> Signed-off-by: Zi Yan <ziy@...dia.com>
> ---
> mm/page_alloc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index bdc8f60ae462..6c6af8658775 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1108,6 +1108,9 @@ static inline void __free_one_page(struct page *page,
>
> buddy_pfn = __find_buddy_pfn(pfn, order);
> buddy = page + (buddy_pfn - pfn);
> +
> + if (!page_is_buddy(page, buddy, order))
> + goto done_merging;
> buddy_mt = get_pageblock_migratetype(buddy);
>
> if (migratetype != buddy_mt
Powered by blists - more mailing lists