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 322DDC77B7C for ; Wed, 10 May 2023 15:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237185AbjEJPpW (ORCPT ); Wed, 10 May 2023 11:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232691AbjEJPpU (ORCPT ); Wed, 10 May 2023 11:45:20 -0400 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC89A94 for ; Wed, 10 May 2023 08:45:18 -0700 (PDT) Received: from in02.mta.xmission.com ([166.70.13.52]:38472) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1pwm0C-009f3m-Tj; Wed, 10 May 2023 09:45:16 -0600 Received: from ip68-110-29-46.om.om.cox.net ([68.110.29.46]:51364 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1pwm0B-006uPF-RI; Wed, 10 May 2023 09:45:16 -0600 From: "Eric W. Biederman" To: Huacai Chen Cc: Luis Chamberlain , Andrew Morton , Kees Cook , chenhuacai@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230509104127.1997562-1-chenhuacai@loongson.cn> Date: Wed, 10 May 2023 10:44:43 -0500 In-Reply-To: <20230509104127.1997562-1-chenhuacai@loongson.cn> (Huacai Chen's message of "Tue, 9 May 2023 18:41:27 +0800") Message-ID: <87ild0w5qs.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=1pwm0B-006uPF-RI;;;mid=<87ild0w5qs.fsf@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.110.29.46;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX1/6Az45sWJkYuh4JpbrMsGatRFJzZ3Jt1c= X-SA-Exim-Connect-IP: 68.110.29.46 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH RFC] kthread: Unify kernel_thread() and user_mode_thread() X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Huacai Chen writes: > Commit 343f4c49f2438d8 ("kthread: Don't allocate kthread_struct for init > and umh") introduces a new function user_mode_thread() for init and umh. > But the name is a bit confusing because init and umh are indeed kernel > threads at creation time, the real difference is "they will become user > processes". No they are not "kernel threads" at creation time. At creation time init and umh are threads running in the kernel. It is a very important distinction and you are loosing it. Because they don't have a kthread_struct such tasks in the kernel are not allowed to depend on anything that is ``kthread''. Having this a separate function highlights the distinction. Highlighting should hopefully cause people to ask why there is a distinction, and what is going on. > So let's unify the kernel_thread() and user_mode_thread() to > kernel_thread() again, and add a new 'user' parameter for init and > umh Now that is confusing. Eric