All of lore.kernel.org
 help / color / mirror / Atom feed
From: C Michael Sundius <Michael.sundius@sciatl.com>
To: linux-mips@linux-mips.org, luigi.mantellini.ml@gmail.com,
	msundius@sundius.com
Subject: Re: Huge buffer allocation: best place
Date: Wed, 08 Oct 2008 09:39:28 -0700	[thread overview]
Message-ID: <48ECE240.5050306@sciatl.com> (raw)

Luigi 'Comio' Mantellini Wrote:

 > I need to allocate a huge contiguous buffer (~6MByte) shared with a 
secondary cpu
 > (a packet processor).  Which is the best place and the best way to do 
this?

 >
 > The main problem is that using a simple kmalloc at module init time 
there isn't sufficient
 > contiguous memory to cover the request. I should use (I suppose) the 
alloc_bootmem_*
 > macros but I'm not sure where is the best place to reserve my memory. 
For now I defined
 > a global bad huge vector... but I'm not happy for this solution...


I have seen a similar need and allocate driver buffers from the bootmem 
allocator, however
if you use Highmem you might prefer to use memory in high memory since 
the low memory
is limited. This presents a problem since the bootmem allocator does not 
manage memory
in the high memory zone.

I am currently working on a extremely simple allocation method for 
allocating large driver buffers
early (say after paging_init() and sparse_init() but before mem_init() ) 
for exactly this
purpose.

I'm wondering if anyone else out there has run into these problems and 
how they solved them.
up to now, we have blindly carved off a huge chunk of the highmemory and 
required each
driver to allocate the driver memory resource at compile time. (via a 
big ugly struct with lots of
magic numbers the drivers map (kmap) these memory areas in separately). 
This error prone a best and
is problematic since each version of our box has different resource 
needs (and we want just one
 kernel). Thus the need for runtime allocation of such resources.

Luigi, are you running w/ highmem enabled? if not I suggest just using 
the bootmem allocator.
we call a function called platform_alloc_bootmem() which is in our 
platform specific code, it is
called just after (or at the end of) the bootmem_init() function in the 
setup.c (after they reserve
space for the initrd and kernel).

there is another function called resource_init() which I think could be 
a good place for you to
make a call to some platform_specific resource allocation function.
(one other question: is any of that resource --from resrouce.c-- used in 
the mips code?)

Mike



     - - - - -                              Cisco                            - - - - -         
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to 
the addressee). If you are not the intended recipient of this message, you are 
not authorized to read, print, retain, copy or disseminate this message or any 
part of it. If you have received this e-mail in error, please notify the sender 
immediately by return e-mail and delete it from your computer.

             reply	other threads:[~2008-10-08 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08 16:39 C Michael Sundius [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-01 18:30 Huge buffer allocation: best place Luigi 'Comio' Mantellini

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=48ECE240.5050306@sciatl.com \
    --to=michael.sundius@sciatl.com \
    --cc=linux-mips@linux-mips.org \
    --cc=luigi.mantellini.ml@gmail.com \
    --cc=msundius@sundius.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.