From patchwork Fri Mar 18 16:25:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Iyer X-Patchwork-Id: 87551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 01C71B6FD7 for ; Sat, 19 Mar 2011 03:26:01 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q0cUu-0003q5-7d; Fri, 18 Mar 2011 16:25:56 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q0cUs-0003pf-OV for kernel-team@lists.ubuntu.com; Fri, 18 Mar 2011 16:25:54 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q0cUs-0002mq-Lw for ; Fri, 18 Mar 2011 16:25:54 +0000 Received: from cpe-72-177-40-4.austin.res.rr.com ([72.177.40.4] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Q0cUp-0006sG-Ck for kernel-team@lists.ubuntu.com; Fri, 18 Mar 2011 16:25:51 +0000 From: Manoj Iyer To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2] PM / Hibernate: Improve comments in hibernate_preallocate_memory() Date: Fri, 18 Mar 2011 11:25:46 -0500 Message-Id: <1300465546-4137-2-git-send-email-manoj.iyer@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1300465546-4137-1-git-send-email-manoj.iyer@canonical.com> References: <1300465546-4137-1-git-send-email-manoj.iyer@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Rafael J. Wysocki One comment in hibernate_preallocate_memory() is wrong, so fix it and add one more comment to clarify the meaning of the fixed one. BugLink: http://launchpad.net/bugs/737208 Signed-off-by: Rafael J. Wysocki (cherry picked from commit 266f1a25eff5ff98c498d7754a419aacfd88f71c) Signed-off-by: Manoj Iyer Acked-by: Stefan Bader --- kernel/power/snapshot.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 7fa52b5..703a057 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1318,12 +1318,14 @@ int hibernate_preallocate_memory(void) /* Compute the maximum number of saveable pages to leave in memory. */ max_size = (count - (size + PAGES_FOR_IO)) / 2 - 2 * SPARE_PAGES; + /* Compute the desired number of image pages specified by image_size. */ size = DIV_ROUND_UP(image_size, PAGE_SIZE); if (size > max_size) size = max_size; /* - * If the maximum is not less than the current number of saveable pages - * in memory, allocate page frames for the image and we're done. + * If the desired number of image pages is at least as large as the + * current number of saveable pages in memory, allocate page frames for + * the image and we're done. */ if (size >= saveable) { pages = preallocate_image_highmem(save_highmem);