[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081116105725.12458b13@infradead.org>
Date: Sun, 16 Nov 2008 10:57:25 -0800
From: Arjan van de Ven <arjan@...radead.org>
To: David Miller <davem@...emloft.net>
Cc: laijs@...fujitsu.com, akpm@...ux-foundation.org, menage@...gle.com,
kamezawa.hiroyu@...fujitsu.com, balbir@...ux.vnet.ibm.com,
jens.axboe@...cle.com, jack@...e.cz, jes@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] mm: introduce simple_malloc()/simple_free()
On Sun, 16 Nov 2008 00:19:26 -0800 (PST)
David Miller <davem@...emloft.net> wrote:
> From: Arjan van de Ven <arjan@...radead.org>
> Date: Sat, 15 Nov 2008 20:52:29 -0800
>
> > On Sun, 16 Nov 2008 12:33:15 +0800
> > Lai Jiangshan <laijs@...fujitsu.com> wrote:
> >
> > >
> > > some subsystem needs vmalloc() when required memory is large.
> > > but current kernel has not APIs for this requirement.
> > > this patch introduces simple_malloc() and simple_free().
> >
> > I kinda really don't like this approach. vmalloc() (and especially,
> > vfree()) is a really expensive operation, and vmalloc()'d memory is
> > also slower (due to tlb pressure). Realistically, people should try
> > hard to use small datastructure instead....
>
> This is happening in many places, already, for good reason.
>
> There are lots of places where we can't (core hash tables, etc.) and
> we want NUMA spreading and reliable allocation, and thus vmalloc it
> is.
vmalloc() isn't 100% evil; for truely long term stuff it's sometimes a
quite reasonable solution.
There are some issues with it still: the vmalloc() space is shared
with ioremap, modules and others and it's not all that big on 32 bit; on
x86 you could well end up with only 64Mb total (after taking out the
various ioremap's etc).
Yes there's places where it's then totally fine to dip into this space
at boot/init time. You mention a few very good users.
(There's still the tlb miss cost on use but on modern cpus a tlb miss
is actually quite cheap)
But this doesn't make vmalloc() the magic bullet that solves the "oh
Linux can't allocate large chunks of memory" problem. Specifically in
driver space for things that get ported from other OSes.
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists