netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: question on pktgen shutdown logic.
Date: Wed, 22 May 2013 16:28:40 -0700	[thread overview]
Message-ID: <519D54A8.4090707@candelatech.com> (raw)
In-Reply-To: <1369264921.3301.370.camel@edumazet-glaptop>

On 05/22/2013 04:22 PM, Eric Dumazet wrote:
> On Wed, 2013-05-22 at 16:15 -0700, Ben Greear wrote:
>> While looking at pktgen.c in 3.9.3, I cannot explain how
>> it does not race on shutdown.
>>
>> The thread worker checks for pktgen_exiting, and will bail out
>> of it's main loop and initiate cleanup if this is true.
>>
>> The pg_net_exit sets the pktgen_exiting to true, and then
>> proceedes to call
>>
>> 		kthread_stop(t->tsk);
>> 		kfree(t);
>>
>> What I don't understand is what keeps the kfree(t) from happening
>> before the thread has noticed pktgen_exiting is set and properly
>> bailed out of it's loop and finished cleanup?
>
> kthread_stop() is synchronous.

Ahh, so it waits for the pktgen_thread_worker method to return?

Why do we bother with the pktgen_exiting flag at all...it
would seem that just checking kthread_should_stop() would
do the trick?

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2013-05-22 23:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22 23:15 question on pktgen shutdown logic Ben Greear
2013-05-22 23:22 ` Eric Dumazet
2013-05-22 23:28   ` Ben Greear [this message]
2013-05-22 23:35     ` Eric Dumazet
2013-05-22 23:52       ` Ben Greear

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=519D54A8.4090707@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).