netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Hillf Danton <hdanton@sina.com>
Cc: dhowells@redhat.com, netdev@vger.kernel.org,
	Marc Dionne <marc.dionne@auristor.com>,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 7/9] rxrpc: Fix I/O thread stop
Date: Sun, 18 Dec 2022 19:59:54 +0000	[thread overview]
Message-ID: <1003225.1671393594@warthog.procyon.org.uk> (raw)
In-Reply-To: <20221218120951.1212-1-hdanton@sina.com>

Hillf Danton <hdanton@sina.com> wrote:

> In line with
> 
> 	if (condition)
> 		return;
> 	add to wait queue
> 	if (!condition)
> 		schedule();
> 
> this change should look like
> 
>    		if (!skb_queue_empty(&local->rx_queue) ...)
>  			continue;
> 
>  		if (kthread_should_stop())
>    			if (!skb_queue_empty(&local->rx_queue) ...)
>  				continue;
> 			else
>   				break;
> 
> as checking condition once barely makes sense.

Really, no.  The condition is going to expand to have a whole bunch of things
in it and I don't want to have it twice, e.g.:

                if (!skb_queue_empty(&local->rx_queue) ||
                   READ_ONCE(local->events) ||
                    !list_empty(&local->call_attend_q) ||
                    !list_empty(&local->conn_attend_q) ||
                    !list_empty(&local->new_client_calls) ||
		    test_bit(RXRPC_CLIENT_CONN_REAP_TIMER,
			     &local->client_conn_flags)) {
			...

Hmmm...  I wonder if kthread_should_stop() needs a barrier associated with
it.  It's just a test_bit(), so the compiler can cache the results of all
these tests - or reorder them.

David


  parent reply	other threads:[~2022-12-18 20:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 16:19 [PATCH net 0/9] rxrpc: Fixes for I/O thread conversion/SACK table expansion David Howells
2022-12-15 16:19 ` [PATCH net 1/9] rxrpc: Fix missing unlock in rxrpc_do_sendmsg() David Howells
2022-12-15 16:19 ` [PATCH net 2/9] rxrpc: Fix security setting propagation David Howells
2022-12-15 16:20 ` [PATCH net 3/9] rxrpc: Fix NULL deref in rxrpc_unuse_local() David Howells
2022-12-15 16:20 ` [PATCH net 4/9] rxrpc: Fix I/O thread startup getting skipped David Howells
2022-12-15 16:20 ` [PATCH net 5/9] rxrpc: Fix locking issues in rxrpc_put_peer_locked() David Howells
2022-12-15 16:20 ` [PATCH net 6/9] rxrpc: Fix switched parameters in peer tracing David Howells
2022-12-15 16:20 ` [PATCH net 7/9] rxrpc: Fix I/O thread stop David Howells
2022-12-15 16:20 ` [PATCH net 8/9] rxrpc: rxperf: Fix uninitialised variable David Howells
2022-12-15 16:20 ` [PATCH net 9/9] rxrpc: Fix the return value of rxrpc_new_incoming_call() David Howells
2022-12-15 19:48 ` [PATCH net 0/9] rxrpc: Fixes for I/O thread conversion/SACK table expansion Marc Dionne
     [not found] ` <20221216001958.1149-1-hdanton@sina.com>
2022-12-16  6:46   ` [PATCH net 7/9] rxrpc: Fix I/O thread stop David Howells
     [not found] ` <20221218120951.1212-1-hdanton@sina.com>
2022-12-18 19:59   ` David Howells [this message]
2022-12-19  0:20   ` David Howells
2022-12-19 10:20 ` [PATCH net 0/9] rxrpc: Fixes for I/O thread conversion/SACK table expansion patchwork-bot+netdevbpf

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=1003225.1671393594@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=hdanton@sina.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.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).