Re: [PATCH] mm/page_alloc: enable alloc bulk when page owner is on

From: Matthew Wilcox
Date: Fri Jul 16 2021 - 07:24:26 EST


On Fri, Jul 16, 2021 at 04:17:53PM +0800, Yang Huan wrote:
> Last alloc bulk version have a bug, when page_owner is on, system maybe
> crashed due to alloc bulk invoke prep_new_page in irq disabled context,
> and set_page_owner use page_flag(may GFP_KERNEL) to get memory and save
> stacktrace.
> We fix it by a circumvention plan -- bandon alloc bulk feature when
> page_owner is set.
> I think both alloc_bulk and page_owner is valuable, so, it's worth to
> find a way enable alloc bulk when page owner is on.

Why do you think it's valuable? The point of alloc_bulk is speed.
Doing the allocation of a stack for each page removes the speed.
Where's the value?

If you're really interested in making both these things work together,
then I observed that all of these pages are going to have the same
allocation stack. Allocating that stack once per call to alloc_bulk,
reference counting it and having each page use the shared stack would
be a good way of combining the two (it'd even save memory!)

This patch, I think, does not make sense.