The patch titled swsusp: Fix alloc_pagedir has been added to the -mm tree. Its filename is swsusp-fix-alloc_pagedir.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: swsusp: Fix alloc_pagedir From: "Rafael J. Wysocki" <rjw@xxxxxxx> Get rid of the FIXME in kernel/power/snapshot.c#alloc_pagedir() and simplify the functions called by it. Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx> Acked-by: Pavel Machek <pavel@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- kernel/power/snapshot.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff -puN kernel/power/snapshot.c~swsusp-fix-alloc_pagedir kernel/power/snapshot.c --- a/kernel/power/snapshot.c~swsusp-fix-alloc_pagedir +++ a/kernel/power/snapshot.c @@ -316,12 +316,12 @@ static void free_pagedir(struct pbe *pbl * fill_pb_page - Create a list of PBEs on a given memory page */ -static inline void fill_pb_page(struct pbe *pbpage) +static inline void fill_pb_page(struct pbe *pbpage, unsigned int n) { struct pbe *p; p = pbpage; - pbpage += PB_PAGE_SKIP; + pbpage += n - 1; do p->next = p + 1; while (++p < pbpage); @@ -330,24 +330,26 @@ static inline void fill_pb_page(struct p /** * create_pbe_list - Create a list of PBEs on top of a given chain * of memory pages allocated with alloc_pagedir() + * + * This function assumes that pages allocated by alloc_image_page() will + * always be zeroed. */ static inline void create_pbe_list(struct pbe *pblist, unsigned int nr_pages) { - struct pbe *pbpage, *p; + struct pbe *pbpage; unsigned int num = PBES_PER_PAGE; for_each_pb_page (pbpage, pblist) { if (num >= nr_pages) break; - fill_pb_page(pbpage); + fill_pb_page(pbpage, PBES_PER_PAGE); num += PBES_PER_PAGE; } if (pbpage) { - for (num -= PBES_PER_PAGE - 1, p = pbpage; num < nr_pages; p++, num++) - p->next = p + 1; - p->next = NULL; + num -= PBES_PER_PAGE; + fill_pb_page(pbpage, nr_pages - num); } } @@ -374,17 +376,17 @@ static struct pbe *alloc_pagedir(unsigne return NULL; pblist = alloc_image_page(gfp_mask, safe_needed); - /* FIXME: rewrite this ugly loop */ - for (pbe = pblist, num = PBES_PER_PAGE; pbe && num < nr_pages; - pbe = pbe->next, num += PBES_PER_PAGE) { + pbe = pblist; + for (num = PBES_PER_PAGE; num < nr_pages; num += PBES_PER_PAGE) { + if (!pbe) { + free_pagedir(pblist, 1); + return NULL; + } pbe += PB_PAGE_SKIP; pbe->next = alloc_image_page(gfp_mask, safe_needed); + pbe = pbe->next; } - if (!pbe) { /* get_zeroed_page() failed */ - free_pagedir(pblist, 1); - pblist = NULL; - } else - create_pbe_list(pblist, nr_pages); + create_pbe_list(pblist, nr_pages); return pblist; } _ Patches currently in -mm which might be from rjw@xxxxxxx are origin.patch make-suspend-possible-with-a-traced-process-at-a-breakpoint.patch git-cifs.patch pm-define-pm_event_prethaw.patch pm-pci-and-ide-handle-pm_event_prethaw.patch pm-video-drivers-and-pm_event_prethaw.patch pm-usb-hcds-use-pm_event_prethaw.patch pm-usb-hcds-use-pm_event_prethaw-fix.patch pm-issue-pm_event_prethaw.patch swsusp-write-timer.patch swsusp-write-speedup.patch swsusp-read-timer.patch swsusp-read-speedup.patch swsusp-read-speedup-fix.patch swsusp-read-speedup-cleanup.patch swsusp-read-speedup-cleanup-2.patch swsusp-clean-up-browsing-of-pfns.patch swsusp-struct-snapshot_handle-cleanup.patch make-swsusp-avoid-memory-holes-and-reserved-memory-regions-on-x86_64.patch disable-cpu-hotplug-during-suspend-2.patch swsusp-fix-mark_free_pages.patch swsusp-reorder-memory-allocating-functions.patch swsusp-fix-alloc_pagedir.patch ide-reprogram-disk-pio-timings-on-resume.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html