Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4111725rwl; Tue, 28 Mar 2023 02:48:01 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/8roQI1m5idLuInqEVSRWg9XuUEBpm7XXJw50IirQP8DAsmp1rxCpZ5ZkhUshOqvuLn8s X-Received: by 2002:a17:906:4bcc:b0:93e:24f6:d7a3 with SMTP id x12-20020a1709064bcc00b0093e24f6d7a3mr14647193ejv.8.1679996881152; Tue, 28 Mar 2023 02:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679996881; cv=none; d=google.com; s=arc-20160816; b=dW/bIdeXre7kIfShg0ETxfjufpfkpebieSt8yZRxiEyXh49vufqL2htrEomaDIFBuf YfMqsNqf5js9kBhYiBx2obtR3bbQSrNgo5Ex+1eLl599fU6cbE47rsIOSJGjhww2MBSb PU6cCSk2imjCklmtLC5TB9bxyTqy0SztY+gXoQAcjsKkhiWxJHnAnCAgK0XdeC/z+Vrp oLDlNST3Fo5OXkXWwunXy1JRAgXg9cnib/VQmrH/MZgxah7Dv9VzKpXu67dvtudq9N+C hlcq/XOSqxxn61DkN3N4SRQLVtu4OVNMHrr2g9kb4hXJM8ziRzq7dcOwxLQR1B91F9hH 8jZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=qD0q3bnfRRfK9P5PPhlEeT7uY9in6BWiZD98LqDkZkc=; b=NROAsOQMbsXIqEhpb68awzJJbU+cBb0QWnDRV6vJ7vsK0ufKbxg0lPRqvVqOTUfE3j Dp1xvqhNvA1tGy3b1VNF59RtGuFBEJ8vn5+0GRKwyNnJcg5em8DWzC7oubHowJxr61vo eV7P14fzvW4gQUMc+VxC0jKeWY5fpLbFuRzvOznuv/ktSxjgokZllASJjn4I4mxPWyZ4 TmW+JJ1G9Yd4QhlunT9OUn3XubVB9R66D7xheVM6C/dwZf4Db55acqf/GX8eRMzVF/E0 Yw0vdLyDR2H+P8uDnb8olUYD/taj0GChMdDjgVFJxQXkEV0lAm1vH7iENRKAcnOhAajc aHHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZExHa1DS; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lz18-20020a170906fb1200b009238a205577si29740292ejb.190.2023.03.28.02.47.31; Tue, 28 Mar 2023 02:48:01 -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=@suse.com header.s=susede1 header.b=ZExHa1DS; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232390AbjC1JlT (ORCPT + 99 others); Tue, 28 Mar 2023 05:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbjC1JlE (ORCPT ); Tue, 28 Mar 2023 05:41:04 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40DB172B8 for ; Tue, 28 Mar 2023 02:40:49 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DF8BD219DC; Tue, 28 Mar 2023 09:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1679996447; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qD0q3bnfRRfK9P5PPhlEeT7uY9in6BWiZD98LqDkZkc=; b=ZExHa1DSQcaCllJva2zxxj2MxPTr5VTCg0W9BBZbWMmvavqWhyLKXH9OG93shfhigdUP5Z 9MK512ALv3d6P0zUf0KJx7frhUfw3oc4JZuxNh/9C6cY0JAUtyO80Yu8lyMQcrFjHOm8BJ r5vvt4YKm+wfPSTLh0mc2R3Nd652GJg= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 861CF2C141; Tue, 28 Mar 2023 09:40:47 +0000 (UTC) Date: Tue, 28 Mar 2023 11:40:46 +0200 From: Petr Mladek To: yu.c.chen@intel.com, akpm@linux-foundation.org, juri.lelli@redhat.com, mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, zyhtheonly@gmail.com, zwp10758@gmail.com, zyhtheonly@yeah.net Subject: Re: [PATCH v3] sched: print parent comm in sched_show_task() Message-ID: References: <20230328034438.GA8421@didi-ThinkCentre-M930t-N000> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230328034438.GA8421@didi-ThinkCentre-M930t-N000> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 On Tue 2023-03-28 11:44:59, Tio Zhang wrote: > Knowing who the parent is might be useful for debugging. > For example, we can sometimes resolve kernel hung tasks by stopping > the person who begins those hung tasks. > With the parent's name printed in sched_show_task(), > it might be helpful to let people know which "service" should be operated. > Also, we move the parent info to a following new line. > It would be better to solve the situation when the task > is not alive and we could not get information about the parent. > > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -8865,14 +8864,19 @@ void sched_show_task(struct task_struct *p) > #ifdef CONFIG_DEBUG_STACK_USAGE > free = stack_not_used(p); > #endif > - ppid = 0; > + > + pr_cont(" stack:%-5lu pid:%-5d flags:0x%08lx\n", > + free, task_pid_nr(p), read_task_thread_flags(p)); > + > rcu_read_lock(); > - if (pid_alive(p)) > - ppid = task_pid_nr(rcu_dereference(p->real_parent)); > + if (pid_alive(p)) { > + struct task_struct *parent = rcu_dereference(p->real_parent); > + > + pr_info("parent:%-15.15s ppid:%-6d", parent->comm, task_pid_nr(parent)); There is a missing new line delimiter "\n". > + } else { > + pr_info("parent:unknown ppid:\n"); > + } > rcu_read_unlock(); > - pr_cont(" stack:%-5lu pid:%-5d ppid:%-6d flags:0x%08lx\n", > - free, task_pid_nr(p), ppid, > - read_task_thread_flags(p)); > > print_worker_info(KERN_INFO, p); > print_stop_info(KERN_INFO, p); Otherwise, it looks good. With the added new line delimiter: Reviewed-by: Petr Mladek Best Regards, Petr