mm/page_alloc: don't corrupt pcppage_migratetype
authorDoug Berger <opendmb@gmail.com>
Fri, 20 Aug 2021 02:04:12 +0000 (19:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 Aug 2021 18:31:42 +0000 (11:31 -0700)
commit47aef6010b837657e1433021bfdeeee7a26a174c
treeb80bb7c6fb36724269828e88d8704a1997dbd708
parentc04b3d06904368b71ab9e09336ecfc91f4009bc9
mm/page_alloc: don't corrupt pcppage_migratetype

When placing pages on a pcp list, migratetype values over
MIGRATE_PCPTYPES get added to the MIGRATE_MOVABLE pcp list.

However, the actual migratetype is preserved in the page and should
not be changed to MIGRATE_MOVABLE or the page may end up on the wrong
free_list.

The impact is that HIGHATOMIC or CMA pages getting bulk freed from the
PCP lists could potentially end up on the wrong buddy list.  There are
various consequences but minimally NR_FREE_CMA_PAGES accounting could
get screwed up.

[mgorman@techsingularity.net: changelog update]

Link: https://lkml.kernel.org/r/20210811182917.2607994-1-opendmb@gmail.com
Fixes: df1acc856923 ("mm/page_alloc: avoid conflating IRQs disabled with zone->lock")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c