diff mbox

[net-next] net: avoid to call skb_queue_len again

Message ID 1417772948-17909-1-git-send-email-roy.qing.li@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Li RongQing Dec. 5, 2014, 9:49 a.m. UTC
From: Li RongQing <roy.qing.li@gmail.com>

the queue length of sd->input_pkt_queue has been putted into qlen,
and impossible to change, since hold the lock

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet Dec. 5, 2014, 1:24 p.m. UTC | #1
On Fri, 2014-12-05 at 17:49 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> the queue length of sd->input_pkt_queue has been putted into qlen,
> and impossible to change, since hold the lock
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
> ---
>  net/core/dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0814a56..b954400 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3297,7 +3297,7 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
>  	rps_lock(sd);
>  	qlen = skb_queue_len(&sd->input_pkt_queue);
>  	if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) {
> -		if (skb_queue_len(&sd->input_pkt_queue)) {
> +		if (qlen) {
>  enqueue:
>  			__skb_queue_tail(&sd->input_pkt_queue, skb);
>  			input_queue_tail_incr_save(sd, qtail);

Acked-by: Eric Dumazet <edumazet@google.com>

Thanks !


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 5, 2014, 2:06 p.m. UTC | #2
Hello.

On 12/5/2014 12:49 PM, roy.qing.li@gmail.com wrote:

> From: Li RongQing <roy.qing.li@gmail.com>

> the queue length of sd->input_pkt_queue has been putted into qlen,

    s/putted/put/, it's irregular verb.

> and impossible to change, since hold the lock

    I can't parse that. Who holds the lock?

> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Dec. 5, 2014, 2:31 p.m. UTC | #3
On Fri, 2014-12-05 at 17:06 +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/5/2014 12:49 PM, roy.qing.li@gmail.com wrote:
> 
> > From: Li RongQing <roy.qing.li@gmail.com>
> 
> > the queue length of sd->input_pkt_queue has been putted into qlen,
> 
>     s/putted/put/, it's irregular verb.
> 
> > and impossible to change, since hold the lock
> 
>     I can't parse that. Who holds the lock?

This thread/cpu holds the lock to manipulate input_pkt_queue.

Otherwise, the following would break horribly....

__skb_queue_tail(&sd->input_pkt_queue, skb);



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Li RongQing Dec. 8, 2014, 12:46 a.m. UTC | #4
On Fri, Dec 5, 2014 at 10:31 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Fri, 2014-12-05 at 17:06 +0300, Sergei Shtylyov wrote:
>> Hello.
>>
>> On 12/5/2014 12:49 PM, roy.qing.li@gmail.com wrote:
>>
>> > From: Li RongQing <roy.qing.li@gmail.com>
>>
>> > the queue length of sd->input_pkt_queue has been putted into qlen,
>>
>>     s/putted/put/, it's irregular verb.
>>

I will fix it and  resend this patch


>> > and impossible to change, since hold the lock
>>
>>     I can't parse that. Who holds the lock?
>
> This thread/cpu holds the lock to manipulate input_pkt_queue.
>
> Otherwise, the following would break horribly....
>
> __skb_queue_tail(&sd->input_pkt_queue, skb);
>
>

Thanks Eric


-Roy
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 8, 2014, 11:28 a.m. UTC | #5
Hello.

On 12/8/2014 3:46 AM, Li RongQing wrote:

>>>> From: Li RongQing <roy.qing.li@gmail.com>

>>>> the queue length of sd->input_pkt_queue has been putted into qlen,

>>>      s/putted/put/, it's irregular verb.

> I will fix it and  resend this patch

>>>> and impossible to change, since hold the lock

>>>      I can't parse that. Who holds the lock?

>> This thread/cpu holds the lock to manipulate input_pkt_queue.

>> Otherwise, the following would break horribly....

>> __skb_queue_tail(&sd->input_pkt_queue, skb);

> Thanks Eric

    I expect you to also refine the description, so that it's meaningful, 
unlike now.

> -Roy

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Dec. 8, 2014, 3:10 p.m. UTC | #6
On Mon, 2014-12-08 at 14:28 +0300, Sergei Shtylyov wrote:

> 
>     I expect you to also refine the description, so that it's meaningful, 
> unlike now.


It seems obvious to me Li is not a native English speaker. I understood
the patch very well, and the changelog seemed fine to me.

What about you provide this description instead, since you seem to care
very much ?

Thanks !


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 8, 2014, 4:51 p.m. UTC | #7
Hello.

On 12/08/2014 06:10 PM, Eric Dumazet wrote:

>>      I expect you to also refine the description, so that it's meaningful,
>> unlike now.

> It seems obvious to me Li is not a native English speaker.

    Me neither. :-)
    However, the good command of English language was a requirement when I was 
first hired to do the Linux development.

> I understood
> the patch very well, and the changelog seemed fine to me.

    Oh, if you say so...

> What about you provide this description instead, since you seem to care
> very much ?

    I mostly care for others; I don't suppose much people except you are able 
to understand the current variant. And I now have neither enough time nor 
enough understanding to write a proper description for this patch. I can only 
suggest that you refine the description for others if you can understand it so 
well.

> Thanks !

    Not at all.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 0814a56..b954400 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3297,7 +3297,7 @@  static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
 	rps_lock(sd);
 	qlen = skb_queue_len(&sd->input_pkt_queue);
 	if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) {
-		if (skb_queue_len(&sd->input_pkt_queue)) {
+		if (qlen) {
 enqueue:
 			__skb_queue_tail(&sd->input_pkt_queue, skb);
 			input_queue_tail_incr_save(sd, qtail);