From: Ying Xue <ying.xue@windriver.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Xue Ying <ying.xue0@gmail.com>,
David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: remove redundant checking for sock timer state
Date: Fri, 1 Feb 2013 15:25:46 +0800 [thread overview]
Message-ID: <510B6DFA.3050601@windriver.com> (raw)
In-Reply-To: <1359703264.30177.37.camel@edumazet-glaptop>
Eric Dumazet wrote:
> On Fri, 2013-02-01 at 15:14 +0800, Xue Ying wrote:
>> Eric Dumazet wrote:
>
>>> I had the same reaction but maybe its not anymore a valid thing.
>>>
>>> Before commit 55c888d6d ([PATCH] timers fixes/improvements) there was
>>> indeed a significant cost calling del_timer() because of unconditional
>>> spinlock acquisition.
>>>
>>> But nowadays del_timer() doesn't blindly lock the spinlock.
>>>
>>> So I guess we could change all occurrences of :
>>>
>>> if (timer_pending(X))
>>> del_timer(X);
>>>
>>> It would save some bytes of code.
>>>
>> Eric, thanks for your explanation and suggestion.
>>
>> But I cannot understand why we should first call timer_pending() before
>> del_timer() in your proposal.
>> By my understanding, we might get an unreal timer pending state out of
>> timer base lock (ie, lock_timer_base()),
>> and the "unreal" is only for pending state, on the contrary, the value
>> is real for inactive sate.
>> So calling timer_pending() out of timer base lock scope can make us
>> avoid some unnecessary grabbing spin lock operations.
>> However, in del_timer() there already has placed a timer_pending()
>> before lock_timer_base() is called. So why do we need
>> another before calling del_timer()?
>>
>> Please you explain more.
>
> I think you misunderstood me.
>
> I said that the old construct :
>
> if (timer_pending(X))
> del_timer(X);
>
> could be changed to
>
> del_timer(X);
>
> Thats what your patch does.
>
> But instead of changing sk_stop_timer(), I suggested you do a patch on
> whole net tree.
>
Fine :) I will do.
Regards,
Ying
>
>
>
next prev parent reply other threads:[~2013-02-01 7:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 5:53 [PATCH] net: remove redundant checking for sock timer state Ying Xue
2013-02-01 6:09 ` David Miller
2013-02-01 6:26 ` Eric Dumazet
2013-02-01 7:14 ` Xue Ying
2013-02-01 7:21 ` Eric Dumazet
2013-02-01 7:25 ` Ying Xue [this message]
2013-02-01 9:26 ` David Laight
2013-02-01 15:22 ` Eric Dumazet
2013-02-01 6:32 ` Ying Xue
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=510B6DFA.3050601@windriver.com \
--to=ying.xue@windriver.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ying.xue0@gmail.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;
as well as URLs for NNTP newsgroup(s).