Re: [RFC PATCH v1 2/3] PM / Runtime: force memory allocation with noI/O during runtime_resume callbcack

From: Ming Lei
Date: Thu Oct 18 2012 - 21:41:31 EST


On Fri, Oct 19, 2012 at 7:16 AM, Rafael J. Wysocki <rjw@xxxxxxx> wrote:
>
> Well, the question is how many runtime resume callbacks actually allocate
> memory. If they are not too many, we can just flag all of them. Otherwise,

At least, almost all pci devices driver in some platform(acpi) and all usb
devices driver allocate memory with GFP_KERNEL which is done in
subsystem, see below:

http://marc.info/?l=linux-kernel&m=135044522501229&w=2

I also found that many usb interface drivers(usblp, uvc, gspca, most of
dvb-usb-v2 media drivers, cpia2, az6007, ....) will do it too.

It is not good to convert all these GFP_KERNEL into GFP_NOIO
because the function doing that will be called in many other contexts.

That is just what I have found. Unfortunately, this allocation can only be
found by human being now, maybe there are many not found since
any function in the resume path(call tree) may allocate memory with
GFP_KERNEL.

In fact, memalloc_noio() can convert some of current static GFP_NOIO
allocation into GFP_KERNEL in other contexts, at least almost all
GFP_NOIO in USB subsystem can be converted into GFP_KERNEL
after applying the approach and make allocation with GFP_IO
only happen in runtime resume/bus reset/block I/O transfer contexts
generally.

> adding a flag may be a better approach. I'm not sure ATM.

OK, I will prepare -v2 with the flag approach for review.


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/