netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sch_gred: should not use GFP_KERNEL while holding a spinlock
@ 2011-12-12  9:42 Eric Dumazet
  2011-12-13  0:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2011-12-12  9:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

gred_change_vq() is called under sch_tree_lock(sch).

This means a spinlock is held, and we are not allowed to sleep in this
context.

We might pre-allocate memory using GFP_KERNEL before taking spinlock,
but this is not suitable for stable material.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/sched/sch_gred.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index b9493a0..6cd8ddf 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -385,7 +385,7 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
 	struct gred_sched_data *q;
 
 	if (table->tab[dp] == NULL) {
-		table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL);
+		table->tab[dp] = kzalloc(sizeof(*q), GFP_ATOMIC);
 		if (table->tab[dp] == NULL)
 			return -ENOMEM;
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sch_gred: should not use GFP_KERNEL while holding a spinlock
  2011-12-12  9:42 [PATCH] sch_gred: should not use GFP_KERNEL while holding a spinlock Eric Dumazet
@ 2011-12-13  0:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-12-13  0:09 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 12 Dec 2011 10:42:53 +0100

> gred_change_vq() is called under sch_tree_lock(sch).
> 
> This means a spinlock is held, and we are not allowed to sleep in this
> context.
> 
> We might pre-allocate memory using GFP_KERNEL before taking spinlock,
> but this is not suitable for stable material.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-13  0:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12  9:42 [PATCH] sch_gred: should not use GFP_KERNEL while holding a spinlock Eric Dumazet
2011-12-13  0:09 ` 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).