mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	Keir.Fraser@cl.cam.ac.uk, Christian.Limpach@cl.cam.ac.uk
Subject: Re: [patch 2] Xen core patch : arch_free_page return value
Date: Thu, 18 Nov 2004 08:35:57 +0000	[thread overview]
Message-ID: <E1CUhlm-0003Ro-00@mta1.cl.cam.ac.uk> (raw)
In-Reply-To: Your message of "Wed, 17 Nov 2004 17:26:41 PST." <1100741201.12373.276.camel@localhost>

> > Pages that have been allocated by our custom allocators get passed
> > into standard linux subsystems where we get no control over how
> > they're freed.
> 
> OK, then how are they allocated?  Are they only allocated by your
> special drivers or in your architecture?

Yes, they are only allocated within our own code. I use "allocation"
loosely here -- in the case of our network backend driver, the page
fragments that we pass into the network subsystem are actually
temporary mappings of other domains' RAM -- not allocated from this
kernel's heap at all.

> I think allowing this is weird:
> 
>         foo = special_zen_malloc();
>         bar = kmalloc();
>         kfree(foo);
>         kfree(bar);
>         
> Shoudn't it be
> 
> 	special_zen_free(free);?

We don't hook into the slab allocator, but into the page_alloc zoned
buddy allocator: so in your example replace kmalloc() with
get_free_page(), and kfree() with free_page(). The point is that we
can't always use 'special_xen_free_page()' because the page's refcnt
may fall to zero within a generic Linux subsystem (e.g., the network
stack). So we need to be able to hook of free_page().

It would be great if we could have a "destructor hook" per page that
points at the relevant heap-free function to use, but that'd never fly
here. This is the best we can do with absolutely minimal source
impact, and no run-time impact on other arches.

> BTW, your arch-specific definition of PG_foreign is a little goofy.  If
> you need the bit, then put it in page-flags.h now.  The memory hotplug
> people have an evil plan to consume all unused bits in page->flags
> (determined at compile-time) and that little gem will certainly break
> it.  

The whole of our foreign_page.h was in page-flags.h. Do you think the
whole lot should go back, or just the bit definition? 

> It's great that you contained stuff to your architecture, but little
> bits like the page-flags thing don't make me think you've done it for
> real, only hacked around it :)

We hacked around it in this case because the PageForeign stuff was
entirely within page_alloc.c and page-flags.h. Since only Xen used it
we were asked if we could have less non-arch source impact and this is
what we came up with. :-) Point taken on PG_foreign though.

 -- Keir

  reply	other threads:[~2004-11-18  8:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 23:48 Ian Pratt
2004-11-18  1:04 ` Dave Hansen
2004-11-18  1:19   ` Ian Pratt
2004-11-18  1:26     ` Dave Hansen
2004-11-18  8:35       ` Keir Fraser [this message]
2004-11-18  9:17         ` Andrew Morton
2004-11-18  5:08     ` Jeff Dike
2004-11-18  3:09       ` Andrew Morton
2004-11-18  6:54         ` Jeff Dike
2004-11-18  4:57           ` Andrew Morton
2004-11-18  8:37 ` Mitchell Blank Jr
2004-11-18 10:05 Ian Pratt
2004-11-18 10:14 ` Andrew Morton
2004-11-18 10:18   ` Keir Fraser
2004-11-18 12:39     ` William Lee Irwin III
2004-11-18 10:36   ` William Lee Irwin III
2004-11-18 12:51     ` Ian Pratt
2004-11-18 12:57       ` William Lee Irwin III

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=E1CUhlm-0003Ro-00@mta1.cl.cam.ac.uk \
    --to=keir.fraser@cl.cam.ac.uk \
    --cc=Christian.Limpach@cl.cam.ac.uk \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®