mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ronghua Zhang <rz5b@cs.virginia.edu>
To: linux-net@vger.kernel.org
Cc: kernelnewbies@nl.linux.org, linux-kernel@vger.kernel.org
Subject: How to send multiple TCP packets from a kernel thread ASAP?
Date: Sun, 29 Jun 2003 10:37:12 -0400 (EDT)	[thread overview]
Message-ID: <Pine.GSO.4.51.0306291023170.12980@mamba.cs.Virginia.EDU> (raw)

Hi,
  I came to a situation that requires to send multiple TCP packets (one
for each connection) from a kernel thread as soon as possible. The
following is the skeleton of my code:

kernel_thread()
{
    foreach sk in (alive connections){
        tp = &(sk->tp_pinfo.af_tcp);

        skb = alloc_skb(xxx, GFP_ATOMIC);
        /* build TCP header */
        tcp_build_and_update_options(.....);
        tp->af_specific->send_check(sk, th, skb->len, skb);

        tp->af_specific->queue_xmit(skb);
        printk("packet send out for sk %p, at %lu\n", sk, jiffies);
    }
}

the output is always like this:
packet send out for sk 1 at 1000
packet send out for sk 2 at 1001
packet send out for sk 3 at 1002
...

It looks like this kernel thread get rescheduled after it has sent out 1
packet. But why? each iteration certainly does not need 10ms, why it get
rescheduled? Is it because af_specific->queue_xmit() is blocking
operation? but I notice that tcp_transmit_skb() also call it, and
tcp_transmit_skb() should not call any blockalbe operation. I try to
increase its priority or change its schedule policy,but has no effect
at all. Any suggestion is appreciated! This is really urgent.


Ronghua

             reply	other threads:[~2003-06-29 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-29 14:37 Ronghua Zhang [this message]
2003-06-29 14:50 ` Matti Aarnio
2003-06-29 15:03   ` Ronghua Zhang

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=Pine.GSO.4.51.0306291023170.12980@mamba.cs.Virginia.EDU \
    --to=rz5b@cs.virginia.edu \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.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

all inboxes | Powered by JetHome®