Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp1670759rwj; Sun, 18 Dec 2022 13:04:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5k2B9RJk1CP83RUaH3zD2B7+j2eZz0Q9Gw1vVeVwVBzIQbUAx4F+24l33dzAJkoI+poEAM X-Received: by 2002:a05:6a20:9f96:b0:a3:9f32:a9d1 with SMTP id mm22-20020a056a209f9600b000a39f32a9d1mr51752906pzb.31.1671397479209; Sun, 18 Dec 2022 13:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671397479; cv=none; d=google.com; s=arc-20160816; b=HGUIkzRPEOEaVnxIUFGAGnSCT0PDQJNxw8wjKTntdVqju7K+rUQlbgGpp90kvsXNyh +n+BfJJQVXbpz8utWK/lO7xCnAHp8o0jpx8HGFKoShOSX7dt9Qmew1fAmNFEtc37+Et7 JEPGpzDBailNnOjBFRwRrYr2KSioxmTqxJ8T5UTMNCE4zu8R5VU1mPiJ+fSbqLhGh/WF VdFvN6Tzl4BHO22wX9Pek33J0Tmm6fnwyywOu5hvDfI0y5ulnm4ZPAhPwOqfs3DxTrB8 eFi/7NyJCBFbKZXQVnbgjEs1bT66p9O4jf61efrpa56U2AfxB9+1YuUCsULqeZzHeZIk ScSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=HeZta9/Ah5Mnc2zLRYpzsO5rZrKVrqZpclQQ8FYgfxk=; b=Ez9Gm0jiIIC/SRw7FfD3tl9ixGwBWJ9WfXKCqiNvjCf/lVwkKUaWMUvFY+xqluf2lm rbVwGVAyCF2acWhVYAeDQN6UFnjmj7LWJKxjSw/ia2xSMIHgAD/eQ9YXUFOWs9QJ48SZ esFoTla6GRqK+ThA4eL5wR0tpjx6UE2Hyz8OBOSUXIK6pWZaIEh0AR0058qQX8xoKUJI 8AKawwXRyH7+XOqFpY9n4MTWrIzQY8Y2AGgK6pRnui35sEgMcHpRamqpFpICxcFjx4xg DrcE7sXrvn5ruMOHvVmehtq9SAf2oNZmqbs+2cCQIMEN8i9SX12zgGU6S3b9gIaWBH+U 4yVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jJL4pfZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v64-20020a638943000000b00478bf145f38si9124660pgd.41.2022.12.18.13.04.27; Sun, 18 Dec 2022 13:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jJL4pfZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbiLRUAu (ORCPT + 70 others); Sun, 18 Dec 2022 15:00:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbiLRUAq (ORCPT ); Sun, 18 Dec 2022 15:00:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F02ED133 for ; Sun, 18 Dec 2022 12:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671393599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HeZta9/Ah5Mnc2zLRYpzsO5rZrKVrqZpclQQ8FYgfxk=; b=jJL4pfZaSZ0L7kBurHszTXZS1K/SEj6YgiC0Tos3IeFekv9YVse/ieAY2SyECXvPJxk8nk 5fmfNjOCKVxp4xmLJ3DqAUY5epRuRI7shf3AjJzUI/CSKpPif/LQFxBzmZoc708xbDvtfk csLn7T8NtuVxkRrF2vRmeeZBHxbi334= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-Kttk09cSMJKjUDIsQWsG3A-1; Sun, 18 Dec 2022 14:59:56 -0500 X-MC-Unique: Kttk09cSMJKjUDIsQWsG3A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A788A3C0D19A; Sun, 18 Dec 2022 19:59:55 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8FAC492C14; Sun, 18 Dec 2022 19:59:54 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20221218120951.1212-1-hdanton@sina.com> References: <20221218120951.1212-1-hdanton@sina.com> <20221216001958.1149-1-hdanton@sina.com> <167112117887.152641.6194213035340041732.stgit@warthog.procyon.org.uk> To: Hillf Danton Cc: dhowells@redhat.com, netdev@vger.kernel.org, Marc Dionne , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net 7/9] rxrpc: Fix I/O thread stop MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1003224.1671393594.1@warthog.procyon.org.uk> Date: Sun, 18 Dec 2022 19:59:54 +0000 Message-ID: <1003225.1671393594@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hillf Danton 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