From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] GFS2: Use kmalloc when possible for ->readdir()
Date: Wed, 28 Jul 2010 17:52:10 +0100 [thread overview]
Message-ID: <1280335930.2502.82.camel@localhost> (raw)
In-Reply-To: <AANLkTinuOVp6dL4c06FyacXp7uGUWNFvGtAUqkYMtjqp@mail.gmail.com>
Hi,
On Wed, 2010-07-28 at 08:39 -0700, Linus Torvalds wrote:
> On Wed, Jul 28, 2010 at 4:15 AM, Steven Whitehouse <swhiteho@redhat.com> wrote:
> >
> > We may be able to eliminate vmalloc entirely at some stage,
> > but this is easy to do right away.
>
> Quite frankly, I'd much rather see this abstracted out a bit. Why not just do a
>
> void *memalloc(unsigned int size)
> {
> if (size < KMALLOC_MAX_SIZE) {
> void *ptr = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
> if (ptr)
> return ptr;
> }
> return vmalloc(size);
> }
>
> void memfree(void *ptr)
> {
> unsigned long addr = (unsigned long) ptr;
>
> if (is_vmalloc_addr(addr)) {
> vfree(ptr);
> return;
> }
>
> kfree(ptr);
> }
>
> wouldn't that be much nicer? No need for that explicit flag, and you
> don't mess up an already way-too-ugly function even more.
>
> Also, I do notice that you used GFP_NOFS, but you didn't use that for
> the vmalloc() thing. If there really are lock reentrancy reasons, you
> _could_ use __vmalloc(size, GFP_NOFS, PAGE_KERNEL). But since you've
> been using vmalloc() for a long time, I suspect GFP_KERNEL works fine.
> Yes/no?
>
> Linus
Well it had been working ok, but I don't really trust it since we are
holding a glock on the directory in shared mode at this point. That
means that if we (as a result of dropping dcache) need to unlink an
inode, we might land up taking glocks in the wrong order.
We use GFP_NOFS everywhere else under glocks for that reason, so I think
its safer to use GFP_NOFS here.
An updated patch based on your comments follows in the next email,
Steve.
next prev parent reply other threads:[~2010-07-28 16:52 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 [this message]
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
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=1280335930.2502.82.camel@localhost \
--to=swhiteho@redhat.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.