public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Bob Picco <bob.picco@hp.com>
Cc: linux-mm@kvack.org, manfred@colorfullife.com,
	alex.williamson@hp.com, linux-kernel@vger.kernel.org,
	akpm@osdl.org
Subject: Re: [PATCH] Early kmalloc/kfree
Date: 09 Jul 2005 00:35:13 +0200	[thread overview]
Message-ID: <p73zmsxncym.fsf@verdi.suse.de> (raw)
In-Reply-To: <20050708203807.GG27544@localhost.localdomain.suse.lists.linux.kernel>

Bob Picco <bob.picco@hp.com> writes:

> We have a requirement on IA64 to run the ACPI interpreter in the setup_arch
> function before paging_init examines the maximum DMA physical address which
> is limited by the IOMMU.  One obstacle is the use of kmalloc/kfree by
> ACPI.  Using the bootmem allocator is unacceptable because > 20Mb of memory
> is wastefully allocated.  As an alternative, I investigated what
> would be required to optionally make the slab allocator available early in
> boot and work in an almost seamless way.
> 
> The patch below is a solution for early kmalloc/kfree.  An architecture which 
> requires kmalloc/kfree use before kmem_cache_init has normally completed can 
> perform the initialization as early as pfn_to_page is a valid operation.  Like 
> the bootmem allocator this point in execution is well known.  An arch that
> requires early kmalloc/kfree chooses the CONFIG_EARLY_KMALLOC option and
> must call kmem_cache_init at the appropriate place in setup_arch.
> 
> The known deficiencies of this solution are similar to the bootmem allocator.
> The placement of the call to kmem_cache_init requires arch dependent code
> knowlege and possibly manipulation of arch dependent code for enablement. 
> kmalloc/kmfree can't be called between when mem_init calls bootmem to free 
> pages and the second call to kmem_cache_init made from start_kernel. A NUMA 
> deficiency, like bootmem allocator, exists for CPU only nodes.  The NUMA node 
> distance information isn't interrogated by bootmem allocator for memory less 
> nodes.
> 
> The slab API hasn't been modified.  All hot code paths are untouched by
> this patch.  The patch has been tested on a 2 CPU SMP box, two node NUMA
> simulated machine with and without memory less nodes. All testing has
> been done on ia64 but nothing prevents other architectures from using the
> patch.
> 
> Manfred provided valuable early review feedback.

I think that is a really really bad idea.   slab is already complex enough
and adding scary hacks like this will probably make it collapse
under its own weight at some point.

And the ACPI interpreter is big enough and has other kernel
interactions that when you start like this you'll probably end with
adding more and more and more such early hacks all over the kernel
longer term. e.g. what happens when the AML creates mutexes and
the interpreter wants to schedule? Or use PCI config space accesses? 
Or something else in the osl layer?  Your early AML might not need
this right now, but longer term someone will write some that 
needs it.

It's better to just not go down that slippery path.

I think you need to solve this in some other way.

-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

       reply	other threads:[~2005-07-08 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050708203807.GG27544@localhost.localdomain.suse.lists.linux.kernel>
2005-07-08 22:35 ` Andi Kleen [this message]
2005-07-10  1:06   ` [PATCH] Early kmalloc/kfree Christoph Lameter
2005-07-11 15:41     ` Alex Williamson
2005-07-08 20:38 Bob Picco

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=p73zmsxncym.fsf@verdi.suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=alex.williamson@hp.com \
    --cc=bob.picco@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=manfred@colorfullife.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