提交 79ffdfc6 编写于 作者: K Kirill Tkhai 提交者: David S. Miller

net: Add rtnl_lock_killable()

rtnl_lock() is widely used mutex in kernel. Some of kernel code
does memory allocations under it. In case of memory deficit this
may invoke OOM killer, but the problem is a killed task can't
exit if it's waiting for the mutex. This may be a reason of deadlock
and panic.

This patch adds a new primitive, which responds on SIGKILL, and
it allows to use it in the places, where we don't want to sleep
forever.
Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 320bd6de
...@@ -33,6 +33,7 @@ extern void rtnl_lock(void); ...@@ -33,6 +33,7 @@ extern void rtnl_lock(void);
extern void rtnl_unlock(void); extern void rtnl_unlock(void);
extern int rtnl_trylock(void); extern int rtnl_trylock(void);
extern int rtnl_is_locked(void); extern int rtnl_is_locked(void);
extern int rtnl_lock_killable(void);
extern wait_queue_head_t netdev_unregistering_wq; extern wait_queue_head_t netdev_unregistering_wq;
extern struct rw_semaphore net_sem; extern struct rw_semaphore net_sem;
......
...@@ -75,6 +75,12 @@ void rtnl_lock(void) ...@@ -75,6 +75,12 @@ void rtnl_lock(void)
} }
EXPORT_SYMBOL(rtnl_lock); EXPORT_SYMBOL(rtnl_lock);
int rtnl_lock_killable(void)
{
return mutex_lock_killable(&rtnl_mutex);
}
EXPORT_SYMBOL(rtnl_lock_killable);
static struct sk_buff *defer_kfree_skb_list; static struct sk_buff *defer_kfree_skb_list;
void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail) void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册