public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* Hibernation out-of-memory problem.
@ 2009-10-10 20:55 Thomas Hellstrom
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellstrom @ 2009-10-10 20:55 UTC (permalink / raw)
  To: linux-pm; +Cc: dri-devel

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.

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()?

Thanks
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hibernation out-of-memory problem.
       [not found] <4AD0F4D0.2090809@vmware.com>
@ 2009-10-12 21:17 ` Rafael J. Wysocki
  2009-10-13 19:25   ` Thomas Hellstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2009-10-12 21:17 UTC (permalink / raw)
  To: linux-pm; +Cc: dri-devel

On Saturday 10 October 2009, Thomas Hellstrom wrote:
> 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.
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hibernation out-of-memory problem.
  2009-10-12 21:17 ` Hibernation out-of-memory problem Rafael J. Wysocki
@ 2009-10-13 19:25   ` Thomas Hellstrom
  2009-10-13 20:35     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Hellstrom @ 2009-10-13 19:25 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm@lists.linux-foundation.org,
	dri-devel@lists.sourceforge.net

Rafael J. Wysocki wrote:
> On Saturday 10 October 2009, Thomas Hellstrom wrote:
>   
>> 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.
>>
>> 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
>   
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hibernation out-of-memory problem.
  2009-10-13 19:25   ` Thomas Hellstrom
@ 2009-10-13 20:35     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2009-10-13 20:35 UTC (permalink / raw)
  To: Thomas Hellstrom
  Cc: linux-pm@lists.linux-foundation.org,
	dri-devel@lists.sourceforge.net

On Tuesday 13 October 2009, Thomas Hellstrom wrote:
> Rafael J. Wysocki wrote:
> > On Saturday 10 October 2009, Thomas Hellstrom wrote:
> >   
> >> 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.
> >>
> >> 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
> >   
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-13 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4AD0F4D0.2090809@vmware.com>
2009-10-12 21:17 ` Hibernation out-of-memory problem Rafael J. Wysocki
2009-10-13 19:25   ` Thomas Hellstrom
2009-10-13 20:35     ` Rafael J. Wysocki
2009-10-10 20:55 Thomas Hellstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox