[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wji_AmYygZMTsPMdJ7XksMt7kOur8oDfDdniBRMjm4VkQ@mail.gmail.com>
Date: Wed, 30 Mar 2022 15:27:04 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Zi Yan <ziy@...dia.com>
Cc: Steven Rostedt <rostedt@...dmis.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 <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: page_alloc: validate buddy before check its migratetype.
On Wed, Mar 30, 2022 at 3:12 PM Zi Yan <zi.yan@...t.com> wrote:
>
> Whenever a buddy page is found, page_is_buddy() should be called to
> check its validity. Add the missing check during pageblock merge check.
Applied.
> buddy_pfn = __find_buddy_pfn(pfn, order);
> buddy = page + (buddy_pfn - pfn);
> +
> + if (!page_is_buddy(page, buddy, order))
> + goto done_merging;
I wonder if that sequence shouldn't be made some helper function.
Also, looking around, I will note that unset_migratetype_isolate() in
mm/page_isolation.c is missing that "page_is_buddy()" check.
I _think_ it's probably ok because we checked
if (PageBuddy(page)) {
on the (original, non-puddy) page, and then we only use the buddy page
pointer for that
if (!is_migrate_isolate_page(buddy)) {
and it's been like that for a _loong_ time.
But honestly, it feels like we would be better off with always having
the page_is_buddy() check anyway.
Or is there some reason why we don't want it here?
Linus
Powered by blists - more mailing lists