From: Hayes Wang <hayeswang@realtek.com>
To: David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
nic_swsd <nic_swsd@realtek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [PATCH net-next v2 2/3] r8152: clear the flagofSCHEDULE_TASKLET in tasklet
Date: Sun, 2 Nov 2014 17:57:16 +0000 [thread overview]
Message-ID: <0835B3720019904CB8F7AA43166CEEB2ECD8A7@RTITMBSV03.realtek.com.tw> (raw)
In-Reply-To: <20141031.161520.3547230591227504.davem@davemloft.net>
David Miller [davem@davemloft.net]
> This is racey.
> If another thread of control sets the bit between the test and the
> clear, you will lose an event.
It is fine. The flag is used to schedule a tasklet, so if the tasklet is
starting running, all the other plans for scheduling a tasklet could
be cleared.
Besides, the flag is only set when a transmission occurs and the
device is in autosuspend mode. Then the workqueue could wake
up the device and schedule the tasklet to make sure the tasklet
wouldn't be run when the device is in suspend mode. Therefore,
if the tasklet is running, it means something happens and the
device is waked up. And the queue for scheduling the tasklet is
unnecessary. We don't need the tasklet runs again after current
one except that the relative tx/rx flows schedule it.
> It really never makes sense to work with atomic bitops in a non-atomic
> test-and-whatever manner like this, it's always a red flag and
> indicates you're doing something very wrong.
I use atomic because I don't wish the different threads which
set the different flags would chang the other bits which they
don't interesting in.
Best Regards,
Hayes
next prev parent reply other threads:[~2014-11-02 17:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 6:03 [PATCH net-next 0/3] Code adjustment Hayes Wang
2014-10-31 6:03 ` [PATCH net-next 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-10-31 6:03 ` [PATCH net-next 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-10-31 6:03 ` [PATCH net-next 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 0/3] Code adjustment Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-10-31 20:15 ` David Miller
2014-11-02 17:57 ` Hayes Wang [this message]
2014-11-02 22:53 ` [PATCH net-next v2 2/3] r8152: clear the flagofSCHEDULE_TASKLET " Francois Romieu
2014-11-03 12:35 ` [PATCH net-next v2 2/3] r8152: clear theflagofSCHEDULE_TASKLETin tasklet Hayes Wang
2014-11-07 10:05 ` Hayes Wang
2014-11-08 22:11 ` Francois Romieu
2014-11-10 5:23 ` [PATCH net-next v2 2/3] r8152: cleartheflagofSCHEDULE_TASKLETintasklet Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 0/3] Code adjustment Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume Hayes Wang
2014-11-12 19:49 ` [PATCH net-next v3 0/3] Code adjustment David Miller
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=0835B3720019904CB8F7AA43166CEEB2ECD8A7@RTITMBSV03.realtek.com.tw \
--to=hayeswang@realtek.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
/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®