From: Marek Lindner <lindner_marek@yahoo.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: Add compatibility code for kfree_rcu
Date: Wed, 4 May 2011 13:51:34 +0200 [thread overview]
Message-ID: <201105041351.35006.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1304496393-16405-3-git-send-email-sven@narfation.org>
On Wednesday 04 May 2011 10:06:30 Sven Eckelmann wrote:
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 1234)
> +
> +#define BAT_KFREE_RCU0(n, x) \
> + static void bat_kfree_rcu_##n(struct rcu_head *head) \
> + {\
> + unsigned long offset = (unsigned long)(x);\
> + kfree((void *)head - offset);\
> + }
> +
> +#define BAT_KFREE_RCU1(n,x) BAT_KFREE_RCU0(n##z,x)
> BAT_KFREE_RCU0(n##o,x+1UL) +#define BAT_KFREE_RCU2(n,x)
> BAT_KFREE_RCU1(n##z,x) BAT_KFREE_RCU1(n##o,x+2UL) +#define
> BAT_KFREE_RCU3(n,x) BAT_KFREE_RCU2(n##z,x) BAT_KFREE_RCU2(n##o,x+4UL)
> +#define BAT_KFREE_RCU4(n,x) BAT_KFREE_RCU3(n##z,x)
> BAT_KFREE_RCU3(n##o,x+8UL) +#define BAT_KFREE_RCU5(n,x)
> BAT_KFREE_RCU4(n##z,x) BAT_KFREE_RCU4(n##o,x+16UL) +#define
> BAT_KFREE_RCU6(n,x) BAT_KFREE_RCU5(n##z,x) BAT_KFREE_RCU5(n##o,x+32UL)
> +#define BAT_KFREE_RCU7(n,x) BAT_KFREE_RCU6(n##z,x)
> BAT_KFREE_RCU6(n##o,x+64UL) +#define BAT_KFREE_RCU8(n,x)
> BAT_KFREE_RCU7(n##z,x) BAT_KFREE_RCU7(n##o,x+128UL)
How about something like this (in compat.h):
static void free_rcu_gw_node(struct rcu_head *rcu)
{
struct gw_node *gw_node;
gw_node = container_of(rcu, struct gw_node, rcu);
kfree(gw_node);
}
#define kfree_rcu(ptr, rcu_head) call_rcu(&ptr->rcu_head, free_rcu_##ptr);
Disclaimer: This is a proof of concept to convey the idea - I did not even try
to compile this code.
Obviously, we would need an extra function for each kfree_rcu() call.
Regards,
Marek
next prev parent reply other threads:[~2011-05-04 11:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 8:06 [B.A.T.M.A.N.] kfree_rcu patches Sven Eckelmann
2011-05-04 8:06 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: Rename bat_printk.c to compat.c Sven Eckelmann
2011-05-07 18:00 ` Marek Lindner
2011-05-04 8:06 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: Add compatibility code for kfree_rcu Sven Eckelmann
2011-05-04 11:51 ` Marek Lindner [this message]
2011-05-04 19:11 ` [B.A.T.M.A.N.] [PATCH-Marek " Sven Eckelmann
2011-05-04 8:06 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: convert call_rcu(gw_node_free_rcu) to kfree_rcu Sven Eckelmann
2011-05-04 8:06 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: convert call_rcu(neigh_node_free_rcu) to kfree() Sven Eckelmann
2011-05-04 8:06 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu Sven Eckelmann
2011-05-10 7:16 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Add compatibility code for kfree_rcu Sven Eckelmann
2011-05-10 7:16 ` [B.A.T.M.A.N.] [PATCHv2 2/4] batman-adv: convert call_rcu(gw_node_free_rcu) to kfree_rcu Sven Eckelmann
2011-05-20 12:29 ` Sven Eckelmann
2011-05-10 7:17 ` [B.A.T.M.A.N.] [PATCHv2 3/4] batman-adv: convert call_rcu(neigh_node_free_rcu) to kfree() Sven Eckelmann
2011-05-20 12:29 ` Sven Eckelmann
2011-05-10 7:17 ` [B.A.T.M.A.N.] [PATCHv2 4/4] batman-adv: convert call_rcu(softif_neigh_free_rcu) to kfree_rcu Sven Eckelmann
2011-05-20 12:30 ` Sven Eckelmann
2011-05-20 12:27 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Add compatibility code for kfree_rcu Sven Eckelmann
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=201105041351.35006.lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.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