[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201103151302.09381.arnd@arndb.de>
Date: Tue, 15 Mar 2011 13:02:09 +0100
From: Arnd Bergmann <arnd@...db.de>
To: paulmck@...ux.vnet.ibm.com
Cc: Lai Jiangshan <laijs@...fujitsu.com>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>,
Manfred Spraul <manfred@...orfullife.com>
Subject: Re: [PATCH V4 1/1] rcu: introduce kfree_rcu()
On Tuesday 15 March 2011, Paul E. McKenney wrote:
> > Another alternative might be to encode the difference between a
> > function pointer and an offset in one of the lower bits of the address.
>
> We discussed this some time back, and it turned out that there were
> CPUs that could legitimately have any combination of low-order bits
> set -- functions could start at any byte address.
>
> If this has changed, I would prefer to use the low-order bits, but
> if it has not, we can't. :-(
Ok, I see.
I just had another idea, which may or may not have new problems:
static inline void *kzalloc_rcu(size_t len, gfp_t flags)
{
struct rcu_head *head = kzalloc(len + sizeof (struct rcu_head), flags);
return head + 1;
}
void __kfree_rcu(struct rcu_head *head)
{
kfree(head);
}
static inline void kfree_rcu(void *p)
{
struct rcu_head *head = p - sizeof (struct rcu_head);
call_rcu(head, __kfree_rcu);
}
The only disadvantage I can see right now is that it messes
with the alignment of the structure.
Arnd
--
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