Skip to contentSkip to conversation

Hibernation out-of-memory problem.

DISCUSSION Rafael J. Wysocki 2 participants 3 messages Oct 12, 2009 – Oct 13, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 12 lines · Thomas Hellstrom

Hi!

I'm trying to port a graphics DRM device driver over to the new power management hooks in

struct dev_pm_ops.

During the "prepare" call, Video RAM contents may be copied either to shmem objects or pages allocated using alloc_page(). Unfortunately, this seems to lead to the hibernation process running out of free pages.

Quoted 7 lines

One possible cause is that the function swsusp_shrink_memory() is called before the prepare() call, and therefore doesn't free up enough memory.

What would be the correct way around this? Should swsusp_shrink_memory() be moved to after prepare(), or is it possible to get some kind of notification after user space processes is stopped, but before swsusp_shrink_memory()?

There are suspend/hibernation notifiers that can be used for this purpose.

Thanks,
Rafael

#2 lore raw
Quoted 23 lines · Rafael J. Wysocki
Quoted 12 lines · Thomas Hellstrom

Hi!

I'm trying to port a graphics DRM device driver over to the new power management hooks in

struct dev_pm_ops.

During the "prepare" call, Video RAM contents may be copied either to shmem objects or pages allocated using alloc_page(). Unfortunately, this seems to lead to the hibernation process running out of free pages.

Quoted 8 lines

One possible cause is that the function swsusp_shrink_memory() is called before the prepare() call, and therefore doesn't free up enough memory.

What would be the correct way around this? Should swsusp_shrink_memory() be moved to after prepare(), or is it possible to get some kind of notification after user space processes is stopped, but before swsusp_shrink_memory()?

Quoted 5 lines

There are suspend/hibernation notifiers that can be used for this purpose.

Thanks,
Rafael

Thanks, Rafael. I tried that and it works fine.

Now, it may be that others will hit this problem as well, as the documentation in <linux/pm.h> states that it is safe to make GFP_KERNEL allocations from within a prepare() callback. Such allocations executed in the prepare() preceeding a freeze() will probably make the amount of previously freed memory insufficient.

Thanks,

Thomas

#3 lore raw
Quoted 29 lines · Thomas Hellstrom
Quoted 23 lines · Rafael J. Wysocki
Quoted 12 lines · Thomas Hellstrom

Hi!

I'm trying to port a graphics DRM device driver over to the new power management hooks in

struct dev_pm_ops.

During the "prepare" call, Video RAM contents may be copied either to shmem objects or pages allocated using alloc_page(). Unfortunately, this seems to lead to the hibernation process running out of free pages.

Quoted 8 lines

One possible cause is that the function swsusp_shrink_memory() is called before the prepare() call, and therefore doesn't free up enough memory.

What would be the correct way around this? Should swsusp_shrink_memory() be moved to after prepare(), or is it possible to get some kind of notification after user space processes is stopped, but before swsusp_shrink_memory()?

Quoted 5 lines

There are suspend/hibernation notifiers that can be used for this purpose.

Thanks,
Rafael

Quoted 7 lines

Thanks, Rafael. I tried that and it works fine.

Now, it may be that others will hit this problem as well, as the documentation in <linux/pm.h> states that it is safe to make GFP_KERNEL allocations from within a prepare() callback. Such allocations executed in the prepare() preceeding a freeze() will probably make the amount of previously freed memory insufficient.

Could you please prepare a patch fixing that comment?

Rafael