netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net] atm: remove an unnecessary loop
@ 2017-01-12  5:02 Cong Wang
  2017-01-12  5:02 ` [Patch net] atm: switch to the new wait API for vcc_sendmsg() Cong Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Cong Wang @ 2017-01-12  5:02 UTC (permalink / raw)
  To: netdev; +Cc: mhocko, romieu, 3chas3, andreyknvl, Cong Wang

alloc_tx() is already inside a wait loop for a successful skb
allocation, this loop inside alloc_tx() is quite unnecessary
and actually problematic.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/atm/common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
index a3ca922..7ec3bbc 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -72,10 +72,11 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size)
 			 sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
 		return NULL;
 	}
-	while (!(skb = alloc_skb(size, GFP_KERNEL)))
-		schedule();
-	pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
-	atomic_add(skb->truesize, &sk->sk_wmem_alloc);
+	skb = alloc_skb(size, GFP_KERNEL);
+	if (skb) {
+		pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
+		atomic_add(skb->truesize, &sk->sk_wmem_alloc);
+	}
 	return skb;
 }
 
-- 
2.5.5

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

end of thread, other threads:[~2017-01-14 11:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-12  5:02 [Patch net] atm: remove an unnecessary loop Cong Wang
2017-01-12  5:02 ` [Patch net] atm: switch to the new wait API for vcc_sendmsg() Cong Wang
2017-01-12  8:43 ` [Patch net] atm: remove an unnecessary loop Michal Hocko
2017-01-13  0:07 ` Francois Romieu
2017-01-13  0:14   ` Cong Wang
2017-01-13 13:23     ` Francois Romieu
2017-01-13 18:18       ` Cong Wang
2017-01-14  0:15         ` Francois Romieu
2017-01-14  0:41           ` Cong Wang
2017-01-13 17:10   ` David Miller
2017-01-13 18:20     ` Cong Wang
2017-01-13 23:54       ` Chas Williams
2017-01-14  0:30         ` Cong Wang
2017-01-14 11:34           ` Chas Williams
2017-01-14  0:14       ` Francois Romieu
2017-01-14  0:24         ` Francois Romieu
2017-01-14  0:36         ` Cong Wang

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).