Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1704914iog; Sat, 25 Jun 2022 17:29:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ugead8csvgQ8+DHq9OLDtWFpEwmB+fudM8NBNBTCR+QC5SJlXzjyaHRR3IGWacalSeWJ/z X-Received: by 2002:a05:6402:2682:b0:437:657f:216f with SMTP id w2-20020a056402268200b00437657f216fmr8146403edd.92.1656203382682; Sat, 25 Jun 2022 17:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656203382; cv=none; d=google.com; s=arc-20160816; b=VhOKL46dVOKxjLOxkjlt3K6rqMWfuk2D75i2eXvG0D1wwZ4nM7NorxlP9k80UxMm+k QKDYVIlePULJ2K2i4ly/sX1aMXqh8HiuZBv2/j3BVuBRjJ/eMH62Ha9YsZBP1eero2qo 3LLP3RDJb/dlWBWBcu4K3NyelxDzhb4F4ZdlYnEsjA++cfU30XpQeVYpfTse9bSrruQV oHubETBGfpZIX//qJeDyh0ld8OLX9P2zdeTbFWxktApiBvFyLeT04CEzz/9+A4XbfBye dvYjSPIgsJncXYeCT0G3+mxNAilKrzeKol0iOOiIERaxuBg53YNrTNSaSI5jza+8P/ek QkwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=GsNjCFsEGZU/CrOx3LqImqpeuSQQAsYR0odkXUnpkYU=; b=gnpY4hPFM27B5aqNP3aCyO56JCOHUdDRve3xJDL8xOYAGj0frUwf6YQ2t/u2cXcAZS RxGDwmSx9+C/V9BpXuFeO+BiGngqiF7Mbv38GB5Goq3W4Db+eoRPcUpKfoTgFB/NNWQ5 eVGqAaayNq0qo6vTiGgBE/ZINKfTd+8yuCcROuDsrUZYOmazFolHrCSxQ9SpfM3Q7/18 a8tHRCfEeeyHu41HMt1+wIY6caO3L6MVRISQlS5PbdGPLaNl9wtsbZr59ciquDE2F7P6 gWPOlmqop/0ADqsBjAEy2uP9nZSSD7gNopDjfzpf2YwlAZdhn5+L+WvobJR7SeDD+WG1 spiQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht15-20020a170907608f00b00716646dc05fsi5677098ejc.860.2022.06.25.17.29.17; Sat, 25 Jun 2022 17:29:42 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233588AbiFZA0Z (ORCPT + 99 others); Sat, 25 Jun 2022 20:26:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbiFZA0X (ORCPT ); Sat, 25 Jun 2022 20:26:23 -0400 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD9E1181F for ; Sat, 25 Jun 2022 17:26:22 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:44156) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o5G6X-009Ew9-Cu; Sat, 25 Jun 2022 18:26:21 -0600 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:57634 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1o5G6W-00AZG4-Dq; Sat, 25 Jun 2022 18:26:21 -0600 From: "Eric W. Biederman" To: Linus Torvalds Cc: Tejun Heo , Petr Mladek , Lai Jiangshan , Michal Hocko , Linux Kernel Mailing List , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Andrew Morton , Oleg Nesterov References: <20220622140853.31383-1-pmladek@suse.com> <874k0863x8.fsf@email.froward.int.ebiederm.org> Date: Sat, 25 Jun 2022 19:26:13 -0500 In-Reply-To: (Linus Torvalds's message of "Sat, 25 Jun 2022 11:25:21 -0700") Message-ID: <87edzcw9qy.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1o5G6W-00AZG4-Dq;;;mid=<87edzcw9qy.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX1+0Ew3aHKu/DFfK6TO/eca53o/6Gled/lY= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 366 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 12 (3.4%), b_tie_ro: 11 (2.9%), parse: 1.24 (0.3%), extract_message_metadata: 17 (4.7%), get_uri_detail_list: 1.65 (0.5%), tests_pri_-1000: 25 (6.8%), tests_pri_-950: 1.26 (0.3%), tests_pri_-900: 1.06 (0.3%), tests_pri_-90: 74 (20.2%), check_bayes: 73 (19.9%), b_tokenize: 7 (1.8%), b_tok_get_all: 7 (2.0%), b_comp_prob: 2.2 (0.6%), b_tok_touch_all: 53 (14.5%), b_finish: 0.91 (0.2%), tests_pri_0: 219 (59.7%), check_dkim_signature: 0.60 (0.2%), check_dkim_adsp: 2.9 (0.8%), poll_dns_idle: 1.10 (0.3%), tests_pri_10: 3.1 (0.8%), tests_pri_500: 9 (2.5%), rewrite_mail: 0.00 (0.0%) Subject: Re: re. Spurious wakeup on a newly created kthread X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > On Sat, Jun 25, 2022 at 10:36 AM Eric W. Biederman > wrote: >> >> Let me suggest someone create a new variant of kthread_create that takes >> all of the parameters the workqueue code wants to set. > > I suspect the real issue is that that the kthread code simply > shouldn't use the kernel_thread() helper at all. > > That helper is literally designed for "start a thread, run this thing". > > That's what it *does*. > > And that's not at all what the kthread code wants. It wants to set > affinity masks, it wants to create a name for the thread, it wants to > do all those other things. > > That code really wants to just do copy_process(). > > Or maybe it really should just use create_io_thread(), which has a > much better interface, except it has that one oddity in that it sets > the flag that does this: > > if (args->io_thread) { > /* > * Mark us an IO worker, and block any signal that isn't > * fatal or STOP > */ > p->flags |= PF_IO_WORKER; > siginitsetinv(&p->blocked, sigmask(SIGKILL)|sigmask(SIGSTOP)); > } > > that then has special semantics. It is worth pointing out kthreads also have special semantics for signals and they are different. In particular kthreads ignore all signals by default. The io_threads are much more userspace threads and the userspace process handles signals, it is just the io_thread that blocks the signals so they will go to real userspace processes. Eric