From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: kosaki.motohiro@jp.fujitsu.com, Changli Gao <xiaosuo@gmail.com>,
akpm@linux-foundation.org, Eric Dumazet <eric.dumazet@gmail.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Avi Kivity <avi@redhat.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Subject: Re: [RFC] mm: generic adaptive large memory allocation APIs
Date: Thu, 13 May 2010 18:05:25 +0900 (JST) [thread overview]
Message-ID: <20100513174512.2179.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <4BEBBBBB.3050201@suse.cz>
Hi
> > Hi
> >
> >> void *kvmalloc(size_t size)
> >> {
> >> void *ptr;
> >>
> >> if (size < PAGE_SIZE)
> >> return kmalloc(PAGE_SIZE, GFP_KERNEL);
> >> ptr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN);
> >
> > low order GFP_KERNEL allocation never fail. then, this doesn't works
> > as you expected.
>
> Hi, I suppose you mean the kmalloc allocation -- so kmalloc should fail
> iff alloc_pages_exact (unless somebody frees a heap of memory indeed)?
I mean, if size of alloc_pages_exact() argument is less than 8 pages,
alloc_pages_exact() never fail. see __alloc_pages_slowpath().
>
> >> if (ptr != NULL)
> >> return ptr;
> >>
> >> return vmalloc(size);
> >
> > On x86, vmalloc area is only 128MB address space. it is very rare
> > resource than physical ram. vmalloc fallback is not good idea.
>
> These functions are a replacement for explicit
> if (!(x = kmalloc()))
> x = vmalloc();
> ...
> if (is_vmalloc(x))
> vfree(x);
> else
> kfree(x);
> in the code (like fdtable does this).
>
> The 128M limit on x86_32 for vmalloc is configurable so if drivers in
> sum need more on some specific hardware, it can be increased on the
> command line (I had to do this on one machine in the past).
Right, but 99% end user don't do this. I don't think this is effective advise.
> Anyway as this is a replacement for explicit tests, it shouldn't change
> the behaviour in any way. Obviously when a user doesn't need virtually
> contiguous space, he shouldn't use this interface at all.
Why can't we make fdtable virtually contiguous free?
Anyway, alloc_fdmem() also don't works as author expected.
next prev parent reply other threads:[~2010-05-13 9:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 0:30 Changli Gao
2010-05-06 0:37 ` Changli Gao
2010-05-06 1:25 ` Changli Gao
2010-05-06 3:12 ` Tetsuo Handa
2010-05-06 3:22 ` Changli Gao
2010-05-06 15:35 ` Jamie Lokier
2010-05-07 4:32 ` Changli Gao
2010-05-07 12:42 ` Tetsuo Handa
2010-05-07 12:52 ` Peter Zijlstra
2010-05-13 4:45 ` KOSAKI Motohiro
2010-05-13 8:43 ` Jiri Slaby
2010-05-13 9:05 ` KOSAKI Motohiro [this message]
2010-05-13 9:19 ` Jiri Slaby
2010-05-13 9:40 ` KOSAKI Motohiro
2010-05-13 10:16 ` Jiri Slaby
2010-05-13 10:43 ` KOSAKI Motohiro
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=20100513174512.2179.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=avi@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=peterz@infradead.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xiaosuo@gmail.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
Powered by JetHome