Re: [PATCH 27/28] mm, page_alloc: Defer debugging checks of freed pages until a PCP drain

From: Vlastimil Babka
Date: Wed Apr 27 2016 - 07:59:13 EST


On 04/15/2016 11:07 AM, Mel Gorman wrote:
Every page free checks a number of page fields for validity. This
catches premature frees and corruptions but it is also expensive.
This patch weakens the debugging check by checking PCP pages at the
time they are drained from the PCP list. This will trigger the bug
but the site that freed the corrupt page will be lost. To get the
full context, a kernel rebuild with DEBUG_VM is necessary.

Signed-off-by: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>

I don't like the duplicated code in free_pcp_prepare() from maintenance perspective, as Hugh just reminded me that similar kind of duplication between page_alloc.c and compaction.c can easily lead to mistakes. I've tried to fix that, which resulted in 3 small patches I'll post as replies here. Could be that the ideas will be applicable also to 28/28 which I haven't checked yet.