From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02C82C43334 for ; Mon, 27 Jun 2022 14:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235200AbiF0OzH (ORCPT ); Mon, 27 Jun 2022 10:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235118AbiF0OzF (ORCPT ); Mon, 27 Jun 2022 10:55:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FF2415FE7 for ; Mon, 27 Jun 2022 07:55:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D0E1E615A1 for ; Mon, 27 Jun 2022 14:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49AC4C3411D; Mon, 27 Jun 2022 14:55:03 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="g4N42kJX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1656341701; 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=WgEinyux4HlcnBBbLgqEe2jqcu3BiHmbct/DDxcrzfA=; b=g4N42kJXVt1UCxJAERhIJhvgsWqV1XEzPPyo4U2CVs9N0qupusktT5AZ4pty7mjiTTFYbY V4Ym8SNocQbDpJcaxomrczDPK5/XIQpnelXVXsr5g9qaU3gyfg7qcNL7ygGyxeHk5hf9gz /vCA/Pnz5qy97Ts2ZN+84Uzb8wOvUJ8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 8401e912 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 27 Jun 2022 14:55:00 +0000 (UTC) Date: Mon, 27 Jun 2022 16:54:54 +0200 From: "Jason A. Donenfeld" To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, ebiederm@xmission.com, Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Johannes Berg Subject: Re: [PATCH] signal: break out of wait loops on kthread_stop() Message-ID: References: <20220627120020.608117-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 03:27:03PM +0200, Peter Zijlstra wrote: > On Mon, Jun 27, 2022 at 02:00:20PM +0200, Jason A. Donenfeld wrote: > > > +bool __kthread_should_stop(struct task_struct *k) > > +{ > > + return (k->flags & PF_KTHREAD) && > > + test_bit(KTHREAD_SHOULD_STOP, &to_kthread(k)->flags); > > +} > > This used to be a racy pattern; not sure it still is since Eric poked at > this last, but please use __to_kthread() instead. Ah, indeed. Will send a v2. Jason