Netdev List
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: Hillf Danton <hdanton@sina.com>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v3] net/core: add optional threading for backlog processing
Date: Mon, 20 Feb 2023 09:23:03 +0100	[thread overview]
Message-ID: <632b578a-10c7-a478-6e89-e44815fcec66@nbd.name> (raw)
In-Reply-To: <20230220004132.2287-1-hdanton@sina.com>

On 20.02.23 01:41, Hillf Danton wrote:
> On Sun, 19 Feb 2023 14:10:05 +0100 Felix Fietkau <nbd@nbd.name>
>>  /* Network device is going away, flush any packets still pending */
>>  static void flush_backlog(struct work_struct *work)
>>  {
>> +	unsigned int process_queue_empty;
>> +	bool threaded, flush_processq;
>>  	struct sk_buff *skb, *tmp;
>>  	struct softnet_data *sd;
>>  
>> @@ -5792,8 +5794,15 @@ static void flush_backlog(struct work_struct *work)
>>  			input_queue_head_incr(sd);
>>  		}
>>  	}
>> +
>> +	threaded = test_bit(NAPI_STATE_THREADED, &sd->backlog.state);
>> +	flush_processq = threaded &&
>> +			 !skb_queue_empty_lockless(&sd->process_queue);
>>  	rps_unlock_irq_enable(sd);
>>  
>> +	if (threaded)
>> +		goto out;
>> +
>>  	skb_queue_walk_safe(&sd->process_queue, skb, tmp) {
>>  		if (skb->dev->reg_state == NETREG_UNREGISTERING) {
>>  			__skb_unlink(skb, &sd->process_queue);
>> @@ -5801,7 +5810,16 @@ static void flush_backlog(struct work_struct *work)
>>  			input_queue_head_incr(sd);
>>  		}
>>  	}
>> +
>> +out:
>>  	local_bh_enable();
>> +
>> +	while (flush_processq) {
>> +		msleep(1);
>> +		rps_lock_irq_disable(sd);
>> +		flush_processq = process_queue_empty == sd->process_queue_empty;
>> +		rps_unlock_irq_enable(sd);
>> +	}
>>  }
> 
> Have hard time guessing how this wait works given process_queue_empty
> not initialized. Is this random check intended?
Please check my initial reply to this patch. I forgot to amend the 
commit with the missing initialization lines before sending out the patch.

- Felix

       reply	other threads:[~2023-02-20  8:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230220004132.2287-1-hdanton@sina.com>
2023-02-20  8:23 ` Felix Fietkau [this message]
2023-02-19 13:10 [RFC v3] net/core: add optional threading for backlog processing Felix Fietkau
2023-02-19 15:08 ` Felix Fietkau
2023-02-19 21:00   ` Eric Dumazet

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=632b578a-10c7-a478-6e89-e44815fcec66@nbd.name \
    --to=nbd@nbd.name \
    --cc=edumazet@google.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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