Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1519419rwl; Wed, 12 Apr 2023 14:21:00 -0700 (PDT) X-Google-Smtp-Source: AKy350Z0QZq9lL2Y6xMDFMRk6ERFBbekof93opMJYWN3otmPMvAIDADwz+X/p8166AZIC4D75RcG X-Received: by 2002:a17:90b:1c09:b0:246:dc4b:d52b with SMTP id oc9-20020a17090b1c0900b00246dc4bd52bmr10441576pjb.44.1681334460462; Wed, 12 Apr 2023 14:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681334460; cv=none; d=google.com; s=arc-20160816; b=bi6dTnoSi2DjV3WTlWznuNvcN7ogNc1k17U7v2bRiVu9pZcxRWoErxwzWIC7n7l+27 oPfjViIZfPHKqlDEBZU0HsLo9XqdphyQGW0a8VtT6E+Wf/G9ijWROI34qWBEMdzcqeaF mNVwQWLJcYucFlJXxNMzZlaD1Vt5uIkLnuhzHf4gkNv5Njsj0pZlk3itLG/m39tJUSBQ kOtBKyUVx8Ftyv2fI60h6uuy9wDjObuwHJEYxMYy7/JZOWUOQixph8UhaP09HeYLramn QVdM1LkQV7zH2FpDqgwZixdXM7zXZUWBjCWkUOeaykcP0E5F5rJTwoaM3cjgZFCN6qy4 ex7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=hEVdiabtXN5n8mFQD1gydxFVV7HpokC8+Beq46nNSNA=; b=v1GM//dzu1xHsMlTgn2+KVUbeRKvOescx6cRBg0IhPNgZZ9WAJeNQApqVomiQx1zgu PvtHi2dRyYNFNckdeKOmSExd2Djkajk4Y2f7tItX00HQ3lNkTZc9qTCJ5G2JuoLLuZcS 00lPtr48qvHUdUlkewRF1kxW38Ihj5Vcgb+WinPsVt0REWzKAcvqYIZSgJeH1tv0MTLj mIB7AV6LFHHrrZPwrH94Gwn+wDz3Z3rQ1HojQWyxkXYgZaEwTeWTJgci0LX05C3yeHPX dWZtxZOKPWAAgq47lxvPtAbSjvLGDQMz9ENhU3eY/7wrycln43c9RrmtNI08gJQhWDVA WVeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=rjkrSfP2; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a6566c3000000b0050c0a48480bsi64483pgw.798.2023.04.12.14.20.48; Wed, 12 Apr 2023 14:21:00 -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; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=rjkrSfP2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbjDLVMU (ORCPT + 99 others); Wed, 12 Apr 2023 17:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbjDLVMT (ORCPT ); Wed, 12 Apr 2023 17:12:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C146A7F; Wed, 12 Apr 2023 14:12:18 -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 F3DFD632B0; Wed, 12 Apr 2023 21:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39BE7C433D2; Wed, 12 Apr 2023 21:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1681333937; bh=9gB2mGFB6sk7lKqjsy7MbN72ZEJ0ICs26aBiPeN3y+Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rjkrSfP2YwvvRScBvxWN9x84liozbr35remjUYkZHRlO/Cswc2psrGCU0AdeqpNjf hOz2ECYBBlmIf7gRobYBN7hw44whuZGlFeHWZIQwkZlNGnCYf8TOSySYm8PrVoDKij 6UfVjVrA3O7JqxPGsGDWuMBtgewVER+Cn6EyBTQw= Date: Wed, 12 Apr 2023 14:12:16 -0700 From: Andrew Morton To: Chunguang Wu Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan Subject: Re: [PATCH] fs/proc: add Kthread flag to /proc/$pid/status Message-Id: <20230412141216.c8f2c1313f34ee0100ac9ae4@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 On Wed, 12 Apr 2023 22:34:02 +0800 Chunguang Wu wrote: > user can know that a process is kernel thread or not. > > ... > > --- a/fs/proc/array.c > +++ b/fs/proc/array.c > @@ -434,6 +434,12 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, > > task_state(m, ns, pid, task); > > + if ((mm == NULL) || (task->flags & PF_KTHREAD)) { > + seq_puts(m, "Kthread:\tYes\n"); > + } else { > + seq_puts(m, "Kthread:\tNo\n"); > + } > + > if (mm) { > task_mem(m, mm); > task_core_dumping(m, task); Well.. Why is this information useful? What is the use case? There are many ways of working this out from the existing output - why is this change required?