* [PATCH] fib_trie: no need to delay vfree()
@ 2013-05-06 2:03 Al Viro
2013-05-06 2:05 ` [PATCH] rps_dev_flow_table_release(): " Al Viro
2013-05-06 15:08 ` [PATCH] fib_trie: " David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Al Viro @ 2013-05-06 2:03 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Now that vfree() can be called from interrupt contexts, there's no
need to play games with schedule_work() to escape calling vfree()
from RCU callbacks.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
Not sure if it's 3.10 or 3.11 fodder - the patch is trivial and
vfree() from RCU callbacks will be exercised in 3.10 anyway (both
for large descriptor tables and for large sysv semaphore arrays).
OTOH, it doesn't fix any bugs, so... Up to you.
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index ff06b75..49616fe 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -125,7 +125,6 @@ struct tnode {
unsigned int empty_children; /* KEYLENGTH bits needed */
union {
struct rcu_head rcu;
- struct work_struct work;
struct tnode *tnode_free;
};
struct rt_trie_node __rcu *child[0];
@@ -383,12 +382,6 @@ static struct tnode *tnode_alloc(size_t size)
return vzalloc(size);
}
-static void __tnode_vfree(struct work_struct *arg)
-{
- struct tnode *tn = container_of(arg, struct tnode, work);
- vfree(tn);
-}
-
static void __tnode_free_rcu(struct rcu_head *head)
{
struct tnode *tn = container_of(head, struct tnode, rcu);
@@ -397,10 +390,8 @@ static void __tnode_free_rcu(struct rcu_head *head)
if (size <= PAGE_SIZE)
kfree(tn);
- else {
- INIT_WORK(&tn->work, __tnode_vfree);
- schedule_work(&tn->work);
- }
+ else
+ vfree(tn);
}
static inline void tnode_free(struct tnode *tn)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] rps_dev_flow_table_release(): no need to delay vfree()
2013-05-06 2:03 [PATCH] fib_trie: no need to delay vfree() Al Viro
@ 2013-05-06 2:05 ` Al Viro
2013-05-06 15:08 ` David Miller
2013-05-06 15:08 ` [PATCH] fib_trie: " David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Al Viro @ 2013-05-06 2:05 UTC (permalink / raw)
To: David Miller; +Cc: netdev
The same story as with fib_trie patch - vfree() from RCU callbacks
is legitimate now.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f8898a4..a94a5a0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -593,7 +593,6 @@ struct rps_dev_flow {
struct rps_dev_flow_table {
unsigned int mask;
struct rcu_head rcu;
- struct work_struct free_work;
struct rps_dev_flow flows[0];
};
#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 7427ab5..981fed3 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -606,21 +606,11 @@ static ssize_t show_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
return sprintf(buf, "%lu\n", val);
}
-static void rps_dev_flow_table_release_work(struct work_struct *work)
-{
- struct rps_dev_flow_table *table = container_of(work,
- struct rps_dev_flow_table, free_work);
-
- vfree(table);
-}
-
static void rps_dev_flow_table_release(struct rcu_head *rcu)
{
struct rps_dev_flow_table *table = container_of(rcu,
struct rps_dev_flow_table, rcu);
-
- INIT_WORK(&table->free_work, rps_dev_flow_table_release_work);
- schedule_work(&table->free_work);
+ vfree(table);
}
static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fib_trie: no need to delay vfree()
2013-05-06 2:03 [PATCH] fib_trie: no need to delay vfree() Al Viro
2013-05-06 2:05 ` [PATCH] rps_dev_flow_table_release(): " Al Viro
@ 2013-05-06 15:08 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-05-06 15:08 UTC (permalink / raw)
To: viro; +Cc: netdev
From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Mon, 6 May 2013 03:03:46 +0100
> Now that vfree() can be called from interrupt contexts, there's no
> need to play games with schedule_work() to escape calling vfree()
> from RCU callbacks.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rps_dev_flow_table_release(): no need to delay vfree()
2013-05-06 2:05 ` [PATCH] rps_dev_flow_table_release(): " Al Viro
@ 2013-05-06 15:08 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-05-06 15:08 UTC (permalink / raw)
To: viro; +Cc: netdev
From: Al Viro <viro@ZenIV.linux.org.uk>
Date: Mon, 6 May 2013 03:05:55 +0100
> The same story as with fib_trie patch - vfree() from RCU callbacks
> is legitimate now.
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-06 15:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 2:03 [PATCH] fib_trie: no need to delay vfree() Al Viro
2013-05-06 2:05 ` [PATCH] rps_dev_flow_table_release(): " Al Viro
2013-05-06 15:08 ` David Miller
2013-05-06 15:08 ` [PATCH] fib_trie: " David Miller
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).