From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 28 May 2002 18:00:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 28 May 2002 18:00:33 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:49930 "EHLO atrey.karlin.mff.cuni.cz") by vger.kernel.org with ESMTP id ; Tue, 28 May 2002 18:00:32 -0400 Date: Wed, 29 May 2002 00:00:32 +0200 From: Pavel Machek To: William Lee Irwin III , kernel list , ACPI mailing list Subject: Re: suspend-to-{RAM,disk} for 2.5.17 Message-ID: <20020528220032.GA3476@atrey.karlin.mff.cuni.cz> In-Reply-To: <20020521222858.GA14737@elf.ucw.cz> <20020527194018.GQ14918@holomorphy.com> <20020528193220.GB189@elf.ucw.cz> <20020528210917.GU14918@holomorphy.com> <20020528211120.GA28189@atrey.karlin.mff.cuni.cz> <20020528212427.GV14918@holomorphy.com> <20020528213408.GE28189@atrey.karlin.mff.cuni.cz> <20020528215318.GW14918@holomorphy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.28i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi! > >> Actually, I just thought of something that might be useful in addition, > >> which is that it would probably only be necessary to search inside of > >> page_zone(page), do you agree? > > On Tue, May 28, 2002 at 11:34:08PM +0200, Pavel Machek wrote: > > Hey, speeding this up is not a top priority. But.. if we can make it > > simpler as well ... ;-). > > Yeah, system startup/shutdown isn't really something to optimize for > aside from dodging some worst cases (which is not relevant here). > > > On Tue, May 28, 2002 at 11:34:08PM +0200, Pavel Machek wrote: > > #ifdef CONFIG_SOFTWARE_SUSPEND > > int is_head_of_free_region(struct page *page) > > { > > zone_t *zone = page_zone(page); > > unsigned long flags; > > int order; > > list_t *curr; > > > > /* > > * Should not matter as we need quiescent system for > > * suspend anyway, but... > > */ > > spin_lock_irqsave(&zone->lock, flags); > > for (order = MAX_ORDER - 1; order >= 0; --order) > > list_for_each(curr, &zone->free_area[order].free_list){ > > if (!curr) > > break; > > if (page == list_entry(curr, struct page,list)) { > > spin_unlock_irqrestore(&zone->lock,flags); > > return 1 << order; > > } > > } > > spin_unlock_irqrestore(&zone->lock, flags); > > return 0; > > } > > #endif /* CONFIG_SOFTWARE_SUSPEND */ > > Does that look okay to you? > > Pavel > > This looks good, though OTOH if we have a page from a zone we should know > the zone exists, and then maybe the if (!curr) check isn't > >> needed. If that's Good point. Killed. > the case the scary check that almost looks like defensive programming won't > be needed at all. Also, is it always expected that this will be a > free page? No. It may be used page, too. That's why it is asking. Pavel -- Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.