From: Andrew Morton <akpm@linux-foundation.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] GFS2: Use kmalloc when possible for ->readdir() (try #2)
Date: Wed, 28 Jul 2010 10:13:27 -0700 [thread overview]
Message-ID: <20100728101327.88dbd7ac.akpm@linux-foundation.org> (raw)
In-Reply-To: <1280336183.2502.87.camel@localhost>
On Wed, 28 Jul 2010 17:56:23 +0100 Steven Whitehouse <swhiteho@redhat.com> wrote:
> +static void *gfs2_alloc_sort_buffer(unsigned size)
> +{
> + void *ptr = NULL;
> +
> + if (size < KMALLOC_MAX_SIZE)
> + ptr = kmalloc(size, GFP_NOFS | __GFP_NOWARN);
> + if (!ptr)
> + ptr = __vmalloc(size, GFP_NOFS, PAGE_KERNEL);
> + return ptr;
> +}
> +
> +static void gfs2_free_sort_buffer(void *ptr)
> +{
> + if (is_vmalloc_addr(ptr))
> + vfree(ptr);
> + else
> + kfree(ptr);
> +}
This got kicked around a bit in May (Subject: mm: generic adaptive
large memory allocation APIs). That patch tried kmalloc(), then
alloc_pages(), then vmalloc(). Nothing got merged though.
I wasn't terribly excited about it because of vague fears that it would
just incite people to spend even less effort thinking about how large
their individual allocations are.
apparmor has a private kvfree/kvmalloc. Probably there are other
versions floating around the tree as well.
next prev parent reply other threads:[~2010-07-28 17:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 11:15 [Cluster-devel] GFS2: Use kmalloc when possible for ->readdir() Steven Whitehouse
2010-07-28 15:39 ` Linus Torvalds
2010-07-28 16:52 ` Steven Whitehouse
2010-07-28 16:56 ` [Cluster-devel] GFS2: Use kmalloc when possible for ->readdir() (try #2) Steven Whitehouse
2010-07-28 17:13 ` Andrew Morton [this message]
2010-07-28 17:51 ` Steven Whitehouse
2010-07-29 17:58 ` Joel Becker
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=20100728101327.88dbd7ac.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).