From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@suspend2.net>,
Nick Piggin <nickpiggin@yahoo.com.au>,
LKML <linux-kernel@vger.kernel.org>, Linux PM <linux-pm@osdl.org>
Subject: Re: [RFC][PATCH] swsusp: support creating bigger images
Date: Tue, 25 Apr 2006 23:12:25 +0200 [thread overview]
Message-ID: <200604252312.26249.rjw@sisk.pl> (raw)
In-Reply-To: <20060425203256.GD6379@elf.ucw.cz>
Hi,
On Tuesday 25 April 2006 22:32, Pavel Machek wrote:
> > > > -unsigned int count_data_pages(void)
> > > > +/**
> > > > + * need_to_copy - determine if a page needs to be copied before saving.
> > > > + * Returns false if the page can be saved without copying.
> > > > + */
> > > > +
> > > > +static int need_to_copy(struct page *page)
> > > > +{
> > > > + if (!PageLRU(page) || PageCompound(page))
> > > > + return 1;
> > > > + if (page_mapped(page))
> > > > + return page_mapped_by_current(page);
> > > > +
> > > > + return 1;
> > > > +}
> > >
> > > I'd much rather VM internal type stuff get moved *out* of kernel/power :(
> >
> > Well, I kind of agree, but I don't know where to place it under mm/.
> >
> > > It needs more comments too. Also, how important is it for the page to be
> > > off the LRU?
> >
> > Hm, I'm not sure if that's what you're asking about, but the pages off the LRU
> > are handled in a usual way, ie. copied when snapshotting the system. The
> > pages _on_ the LRU may be included in the snapshot image without
> > copying, but I require them additionally to be (a) mapped by someone and
> > (b) not mapped by the current task.
>
> Why do you _want_ them mapped by someone?
Because this means they belong to a task that is frozen and won't touch them
(of course unless it's us). The kernel has no reason to access them either
(even after we resume devices) except for reclaiming, but that's handled
explicitly. Thus it's safe to include them in the image without copying.
As I said before, I think the page cache pages may be treated this way too.
It probably applies to all of the LRU pages, but there may be some corner
cases. The mapped pages are just easy to single out.
> > > b) Why are you clearing PageLRU outside the spinlock?
> >
> > Well, good question. ;-) Moreover it seems I don't need to acquire the
> > spinlock at all, because this is done on one CPU with IRQs disabled and the
> > other tasks frozen.
>
> Well, it is probably better to still take the spinlock. That way, if
> something goes wrong we get deadlock, not anything worse.
OK, so I'll just clear/set the LRU flag under the spinlock.
Greetings,
Rafael
next prev parent reply other threads:[~2006-04-25 21:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-24 21:55 [RFC][PATCH] swsusp: support creating bigger images Rafael J. Wysocki
2006-04-24 22:16 ` Pavel Machek
2006-04-25 8:26 ` Rafael J. Wysocki
2006-04-25 10:04 ` Pavel Machek
2006-04-25 10:31 ` Rafael J. Wysocki
2006-04-27 15:27 ` Rafael J. Wysocki
2006-04-27 20:55 ` Pavel Machek
2006-04-28 9:19 ` Rafael J. Wysocki
2006-04-28 9:23 ` Pavel Machek
2006-04-25 10:28 ` Nick Piggin
2006-04-25 15:39 ` Rafael J. Wysocki
2006-04-25 20:32 ` Pavel Machek
2006-04-25 21:12 ` Rafael J. Wysocki [this message]
2006-04-25 21:18 ` Nigel Cunningham
2006-04-25 22:21 ` Rafael J. Wysocki
2006-04-25 22:24 ` Nigel Cunningham
2006-04-25 22:38 ` Rafael J. Wysocki
2006-04-25 22:25 ` Pavel Machek
2006-04-25 22:30 ` Nigel Cunningham
2006-04-25 22:36 ` Pavel Machek
2006-04-25 22:43 ` Rafael J. Wysocki
2006-04-26 0:49 ` Nigel Cunningham
2006-04-30 12:27 ` Rafael J. Wysocki
2006-05-01 1:49 ` Nigel Cunningham
2006-05-01 11:20 ` Rafael J. Wysocki
2006-05-01 22:56 ` Nigel Cunningham
2006-04-26 2:24 ` Nick Piggin
2006-04-26 3:41 ` Nigel Cunningham
2006-04-26 16:22 ` Nick Piggin
2006-04-26 21:16 ` Rafael J. Wysocki
2006-04-26 8:10 ` Pavel Machek
2006-04-27 19:53 ` [RFC][PATCH] swsusp: support creating bigger images (rev. 2) Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604252312.26249.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@osdl.org \
--cc=nickpiggin@yahoo.com.au \
--cc=nigel@suspend2.net \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox