linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@cyclades.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-mm <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] Dynamically allocated pageflags
Date: Thu, 9 Feb 2006 17:08:50 +1000	[thread overview]
Message-ID: <200602091708.55203.ncunningham@cyclades.com> (raw)
In-Reply-To: <aec7e5c30602082300i6257606csdc005e6a442bfec5@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]

Hi.

On Thursday 09 February 2006 17:00, Magnus Damm wrote:
> Hi Nigel,
> 
> On 2/2/06, Nigel Cunningham <ncunningham@cyclades.com> wrote:
> > Hi everyone.
> >
> > This is my latest revision of the dynamically allocated pageflags patch.
> >
> > The patch is useful for kernel space applications that sometimes need to flag
> > pages for some purpose, but don't otherwise need the retain the state. A prime
> > example is suspend-to-disk, which needs to flag pages as unsaveable, allocated
> > by suspend-to-disk and the like while it is working, but doesn't need to
> > retain any of this state between cycles.
> >
> > Since the last revision, I have switched to using per-zone bitmaps within each
> > bitmap.
> >
> > I know that I could still add hotplug memory support. Is there anything else
> > missing?
> 
> I like the idea of the patch, but the code looks a bit too complicated
> IMO. What is wrong with using vmalloc() to allocate a virtual
> contiguous range of 0-order pages (one bit per page), and then use the
> functions in linux/bitmap.h...? Or maybe I'm misunderstanding.
> 
> A system that has 2 GB RAM and 4 KB pages would use 64 KB per bitmap
> (one bitmap per node), which is not so bad memory wise if you plan to
> use all bits.
> 
> OTOH, if your plan is to use a single bit here and there, and leave
> most of the bits unused then some kind of tree is probably better.
> 
> Or does the kernel already implement some kind of data structure that
> never consumes _that_ much more space than a bitmap when fully used,
> and saves a lot of memory when just sparsely populated?

Thanks for the suggestion - I'll look into it too.

Part of my reason for implementing them in this way was to make serialising
the data in an image header easy, when suspending to disk. I use the
bitmaps to record which pages were atomically copied, and generate a
similar bitmap for addresses of the freshly loaded pages prior to restoring
the image at resume time. Of course the routines that does the atomic
restore also iterates through these bitmaps. I'm not sure whether that
changes anything, but thought it was worth mentioning.

Regards,

Nigel

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2006-02-09  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 11:11 Nigel Cunningham
2006-02-02 13:31 ` Andi Kleen
2006-02-02 16:47   ` Dave Hansen
2006-02-08 23:43   ` Nigel Cunningham
2006-02-09  7:00 ` Magnus Damm
2006-02-09  7:08   ` Nigel Cunningham [this message]

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=200602091708.55203.ncunningham@cyclades.com \
    --to=ncunningham@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=magnus.damm@gmail.com \
    /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