From: "Dave Airlie" <airlied@gmail.com>
To: "Arjan van de Ven" <arjan@infradead.org>
Cc: "David Miller" <davem@davemloft.net>,
laijs@cn.fujitsu.com, akpm@linux-foundation.org,
menage@google.com, kamezawa.hiroyu@jp.fujitsu.com,
balbir@linux.vnet.ibm.com, jens.axboe@oracle.com, jack@suse.cz,
jes@sgi.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] mm: introduce simple_malloc()/simple_free()
Date: Mon, 17 Nov 2008 08:42:45 +1000 [thread overview]
Message-ID: <21d7e9970811161442h7354734cvd711e48b468b8196@mail.gmail.com> (raw)
In-Reply-To: <20081116135130.5e8b4e13@infradead.org>
On Mon, Nov 17, 2008 at 7:51 AM, Arjan van de Ven <arjan@infradead.org> wrote:
> On Mon, 17 Nov 2008 07:39:55 +1000
> "Dave Airlie" <airlied@gmail.com> wrote:
>
>> On Mon, Nov 17, 2008 at 4:57 AM, Arjan van de Ven
>> <arjan@infradead.org> wrote:
>> > On Sun, 16 Nov 2008 00:19:26 -0800 (PST)
>> > David Miller <davem@davemloft.net> wrote:
>> >
>> >> From: Arjan van de Ven <arjan@infradead.org>
>> >> Date: Sat, 15 Nov 2008 20:52:29 -0800
>> >>
>> >> > On Sun, 16 Nov 2008 12:33:15 +0800
>> >> > Lai Jiangshan <laijs@cn.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.
>>
>> So we keep the duplicated code? or we just audit new callers.... I
>> think this patch
>> makes it easier to spot new callers doing something stupid. As davem
>> said we duplicate
>> this code all over the place, so for that reason along a simple
>> wrapper makes things a lot
>> easier, and also possibly a lot easier to change in the future to a
>> new non-sucky API.
>>
>> So I'm all for it maybe with a non simple name.
>>
>
> I would go further than this.
>
> Make the code just use vmalloc(). Period.
>
> But then make vmalloc() smart and try do a direct mapping allocation
> first, before falling back to a virtual mapping. (and based on size it
> wouldn't even try it for just big things
I seem to remember Christoph Lameter having something along these
lines before, did
vcompound do some of this type of thing...
Dave.
next prev parent reply other threads:[~2008-11-16 22:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-16 4:33 Lai Jiangshan
2008-11-16 4:49 ` Alexey Dobriyan
2008-11-16 8:14 ` David Miller
2008-11-16 18:42 ` KOSAKI Motohiro
2008-11-16 4:52 ` Arjan van de Ven
2008-11-16 5:03 ` Andrew Morton
2008-11-16 5:35 ` Lai Jiangshan
2008-11-16 5:47 ` Andrew Morton
2008-11-16 5:53 ` Arjan van de Ven
2008-11-16 6:08 ` Eric Dumazet
2008-11-16 8:23 ` David Miller
2008-11-16 8:21 ` David Miller
2008-11-16 8:19 ` David Miller
2008-11-16 18:57 ` Arjan van de Ven
2008-11-16 21:39 ` Dave Airlie
2008-11-16 21:51 ` Arjan van de Ven
2008-11-16 22:42 ` Dave Airlie [this message]
2008-11-17 2:08 ` Lai Jiangshan
2008-11-17 4:53 ` Balbir Singh
2008-11-17 5:25 ` KAMEZAWA Hiroyuki
2008-11-17 6:43 ` KOSAKI Motohiro
2008-11-17 7:13 ` Andrew Morton
2008-11-17 7:15 ` David Miller
2008-11-17 8:10 ` KOSAKI Motohiro
2008-11-17 8:24 ` Balbir Singh
2008-11-18 4:39 ` Nick Piggin
2008-11-18 5:16 ` Lai Jiangshan
2008-11-17 4:46 ` Balbir Singh
2008-11-17 4:43 ` Balbir Singh
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=21d7e9970811161442h7354734cvd711e48b468b8196@mail.gmail.com \
--to=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=jack@suse.cz \
--cc=jens.axboe@oracle.com \
--cc=jes@sgi.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.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
all inboxes | Powered by JetHome®