kmalloc during suspend, was Re: PCI PM: Restore standard config registers of all devices early

Pavel Machek
2009-02-10T20:26:08Z

On Tue 2009-02-03 12:03:46, Benjamin Herrenschmidt wrote:
>
> > > (*) There are reasons to think that kmalloc/gfp should both silently
> > > turn into GFP_NOIO always while the suspend process is started, but
> > > that's somewhat a different subject. Rafael, did we ever act on that ?
> > > It's an old discussion we had but I don't know if we actually
> > > implemented anything.
> >
> > We have the ->prepare(), ->complete() callbacks that, among other things,
> > can be used for allocating and freeing memory with GFP_KERNEL safely.
>
> First, that's assuming drivers will be smart enough to figure that out.
> They won't, believe me.

For big alocations, I see no other way. If someone wants 100MB for
firmmware image...

> Then, as I said, this doesn't work in practice because there is no way
> drivers and/or underlying subsystems will start "remembering" when they
> are within a prepare/complete pair, and suddenly do allocations
> differently. That's just going to break.

They could set a flag in ->prepare()... but yes, drivers will get that
wrong.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html