From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751130AbWDKVhA (ORCPT ); Tue, 11 Apr 2006 17:37:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751129AbWDKVhA (ORCPT ); Tue, 11 Apr 2006 17:37:00 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:57754 "EHLO atrey.karlin.mff.cuni.cz") by vger.kernel.org with ESMTP id S1751130AbWDKVhA (ORCPT ); Tue, 11 Apr 2006 17:37:00 -0400 Date: Tue, 11 Apr 2006 23:36:59 +0200 From: Pavel Machek To: "Rafael J. Wysocki" Cc: Nick Piggin , Fabio Comolli , linux-kernel@vger.kernel.org Subject: Re: Userland swsusp failure (mm-related) Message-ID: <20060411213659.GA9548@atrey.karlin.mff.cuni.cz> References: <200604090047.17372.rjw@sisk.pl> <443868A5.1020503@yahoo.com.au> <200604112333.22677.rjw@sisk.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604112333.22677.rjw@sisk.pl> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > Rafael J. Wysocki wrote: > > >>>Well, it looks like we didn't free enough RAM for suspend in this case. > > >>>Unfortunately we were below the min watermark for ZONE_NORMAL and > > >>>we tried to allocate with GFP_ATOMIC (Nick, shouldn't we fall back to > > >>>ZONE_DMA in this case?). > > >>> > > >>>I think we can safely ignore the watermarks in swsusp, so probably > > >>>we can set PF_MEMALLOC for the current task temporarily and reset > > >>>it when we have allocated memory. Pavel, what do you think? > > >> > > >>Seems little hacky but okay to me. > > >> > > >>Should not fixing "how much to free" computation to free a bit more be > > >>enough to handle this? > > > > > > > > > Yes, but in that case we'll leave some memory unused. ;-) > > > > > > > Probably doesn't fall back to ZONE_DMA because of lowmem reserve. > > Yes, PF_MEMALLOC sounds like it might do what you want. A little > > hackish perhaps, but better than putting swsusp special cases > > into page_alloc.c. > > The appended patch contains the changes I'd like to make. Pavel, is that > acceptable? Why is PF_MEMALLOC only neccessary for pagedir allocations, and not for normal page allocations, too? > Rafael > > --- > kernel/power/snapshot.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > > Index: linux-2.6.17-rc1-mm2/kernel/power/snapshot.c > =================================================================== > --- linux-2.6.17-rc1-mm2.orig/kernel/power/snapshot.c 2006-04-08 21:29:55.000000000 +0200 > +++ linux-2.6.17-rc1-mm2/kernel/power/snapshot.c 2006-04-11 22:09:28.000000000 +0200 > @@ -461,17 +461,23 @@ static struct pbe *swsusp_alloc(unsigned > { > struct pbe *pblist; > > + /* We don't want to be affected by zone watermarks etc. */ > + current->flags |= PF_MEMALLOC; > + > if (!(pblist = alloc_pagedir(nr_pages, GFP_ATOMIC | __GFP_COLD, 0))) { > printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); > - return NULL; > + goto out; > } > > if (alloc_data_pages(pblist, GFP_ATOMIC | __GFP_COLD, 0)) { > printk(KERN_ERR "suspend: Allocating image pages failed.\n"); > swsusp_free(); > - return NULL; > + pblist = NULL; > } > > +out: > + current->flags &= ~PF_MEMALLOC; > + > return pblist; > } > -- Thanks, Sharp!