Re: [PATCH] mm/page_alloc: Add a reason for reserved pages in has_unmovable_pages()

From: Andrew Morton
Date: Sat Oct 05 2019 - 17:23:14 EST


On Fri, 4 Oct 2019 16:41:50 +0200 Michal Hocko <mhocko@xxxxxxxxxx> wrote:

> > > This is just insane. The hotplug code is in no way special wrt printk.
> > > It is never called from the printk code AFAIK and thus there is no real
> > > reason why this particular code should be any special. Not to mention
> > > it calls printk indirectly from a code that is shared with other code
> > > paths.
> >
> > Basically, printk() while holding the zone_lock will be problematic as console
> > is doing the opposite as it always needs to allocate some memory. Then, it will
> > always find some way to form this chain,
> >
> > console_lock -> * -> zone_lock.
>
> So this is not as much a hotplug specific problem but zone->lock ->
> printk -> alloc chain that is a problem, right? Who is doing an
> allocation from this atomic context? I do not see any atomic allocation
> in kernel/printk/printk.c.

Apparently some console drivers can do memory allocation on the printk()
path.

This behavior is daft, IMO. Have we identified which ones and looked
into fixing them?