From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754341AbbIIMYU (ORCPT ); Wed, 9 Sep 2015 08:24:20 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35422 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbbIIMYM (ORCPT ); Wed, 9 Sep 2015 08:24:12 -0400 Date: Wed, 9 Sep 2015 13:24:08 +0100 From: Matt Fleming To: joeyli Cc: "Lee, Chun-Yi" , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Matthew Garrett , Len Brown , Pavel Machek , Josh Boyer , Vojtech Pavlik , Matt Fleming , Jiri Kosina , "H. Peter Anvin" , Ingo Molnar Subject: Re: [PATCH v2 09/16] PM / hibernate: Reserve hibernation key and erase footprints Message-ID: <20150909122408.GE4973@codeblueprint.co.uk> References: <1439273796-25359-1-git-send-email-jlee@suse.com> <1439273796-25359-10-git-send-email-jlee@suse.com> <20150821132753.GC3310@codeblueprint.co.uk> <20150827102144.GE27415@linux-rxt1.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150827102144.GE27415@linux-rxt1.site> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Aug, at 06:21:44PM, joeyli wrote: > On Fri, Aug 21, 2015 at 02:27:53PM +0100, Matt Fleming wrote: > > On Tue, 11 Aug, at 02:16:29PM, Lee, Chun-Yi wrote: > > > +static int __init init_hibernation_keys(void) > > > +{ > > > + struct hibernation_keys *keys; > > > + int ret = 0; > > > + > > > + if (!keys_phys_addr) > > > + return -ENODEV; > > > + > > > + keys = early_memremap(keys_phys_addr, sizeof(struct hibernation_keys)); > > > + > > > + /* Copy hibernation keys to a allocated page */ > > > + hibernation_keys = (struct hibernation_keys *)get_zeroed_page(GFP_KERNEL); > > > + if (hibernation_keys) { > > > + *hibernation_keys = *keys; > > > + } else { > > > + pr_err("PM: Allocate hibernation keys page failed\n"); > > > + ret = -ENOMEM; > > > + } > > > > It seems overkill to allocate an entire page for 28 bytes of data. > > > > Here to allocate an entire page because the basic unit is 'page' when > hibernation code checking saveable page that should included/excluded in > snapshot image. > Allocating an page to hibernation key can clearer to check the page should > excluded in snapshot image. Do other pieces of code do something similar, i.e. allocate an entire page because the hibernation code deals with pages? If so, it might be possible to lump all these pieces of data together into a single 'auxiliary' page. -- Matt Fleming, Intel Open Source Technology Center