Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2744316rwl; Mon, 27 Mar 2023 04:52:38 -0700 (PDT) X-Google-Smtp-Source: AKy350b4iikgmlDG8fS3VS7mYLcdr0iv9zkzteLmOrvgt54zTIHHIL++tF0JZW785uNzjlrSl8HG X-Received: by 2002:a17:90b:4d92:b0:23d:3c7b:8684 with SMTP id oj18-20020a17090b4d9200b0023d3c7b8684mr12564093pjb.41.1679917958060; Mon, 27 Mar 2023 04:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679917958; cv=none; d=google.com; s=arc-20160816; b=Munp1flpMeEMQv/XV/GM3ieF9gc4dDDOZSA4Xz3AYLtAeMiJojj4YWqC2+PtqP6F2X 2I1QftngHWzX9ZKl80EZvJIEUop4Pg1qc5t8YmILLN8izEcAKkT/ipqDLYZtYSppyf4c kT5vNc0BSimwOQU5e2WZ85qRVN3yGTGJ4feqATL1gs/Lcmo9ahsQ/Gr7YYU86US8OUN5 F1F+PbA1LqxR5eSO1yEEHafYk07+qD7Hdr9PcEYMV1k8uaL3c00oJSurDMptuqYYGPnI hE/YARHdUToc9i4SgK8aq2LGx8yZ4T9IVAcWCNtBBM2LBDQQXgBBNnvjGlX5+K7g7Qxh ltHQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+ITToL9qlixtPnwpo2U36saKVXVZuLAiBEtIMpOiQ0Q=; b=MkGkI5tkRR6b1/TuPmPxbnzJlZQTmZS6NaYM/AgoSB3mpdKg9Qa+DSCBZYe3mXJ02f qdHAA8uKAM9wiaDvzLq36PZ6MDWKyEuPQDwJmQM3y0k5Z7BcpJDQlJ1MSLh78seXeZC2 xzWoSjvOlTpTJUnh8jkU90NvTFvvRZr02VdAarvEwBOX0E8432hH1yDA2kl/94plNHaV kq/vwGO2WO1Di/sLcY1MUzEYi5Y0sKc1EoFu60f+Ao8XoVkRyLvewGBEky1fvi0H+OOC X3P1pDS1vL6f3356XAJ5uW2XkKo3Gv7nifqWYDyTpNVewM/8YYRRXCHcJOM+cTVU6CR1 fYkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=d+Ins1qj; 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 q19-20020a632a13000000b0050beb3fe60esi28063561pgq.461.2023.03.27.04.52.25; Mon, 27 Mar 2023 04:52:38 -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=d+Ins1qj; 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 S232458AbjC0Lnm (ORCPT + 99 others); Mon, 27 Mar 2023 07:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbjC0Lnl (ORCPT ); Mon, 27 Mar 2023 07:43:41 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1845810FD for ; Mon, 27 Mar 2023 04:43:40 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C859021D12; Mon, 27 Mar 2023 11:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1679917418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+ITToL9qlixtPnwpo2U36saKVXVZuLAiBEtIMpOiQ0Q=; b=d+Ins1qjZS2C20yrn7iIIbY/r5A17RDuzrdULkjbD4/GROf4RmueFiogd0UIlN0Jf3NWir Al8AnSREcuIMWUCBszHA/IIFLSUERmciOeg3cgTZBAL/slTPwlwEmUFtLpwDeTS4Pna2W6 TQSchYz1fGwXvfpSO7H8Y3FGukvh1NY= Received: from suse.cz (unknown [10.100.201.202]) (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 3F4322C141; Mon, 27 Mar 2023 11:43:38 +0000 (UTC) Date: Mon, 27 Mar 2023 13:43:37 +0200 From: Petr Mladek To: Yuanhan Zhang Cc: Chen Yu , juri.lelli@redhat.com, mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, zwp10758@gmail.com, zyhtheonly@yeah.net, tiozhang@didiglobal.com Subject: Re: [RESEND][PATCH v2 2/2] sched: print parent comm in sched_show_task() Message-ID: References: <20230131080911.GA1601@didi-ThinkCentre-M930t-N000> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Hi, please, send the patch as a plain text generated by git format-patch. Ideally send it using git send-email. Also please use: [PATCH v3] instead of [PATCH v2 2/2]. This [RESEND] was a multi-part mail with html. It is hard to proceed by the tools like "b4". And it was even ignored by https://lore.kernel.org/ so that it is not acrived. The whole thread is messy. I suggest to send sent it as a new mail (In-Reply-To). Also, please, add Andrew Morton . He might take this kind of patch. Otherwise, the patch looks OK. Best Regards, Petr On Thu 2023-03-23 19:01:03, Yuanhan 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. > > Signed-off-by: Tio Zhang > --- > kernel/sched/core.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index cb2aa2b54c7a..d8fd35684d6c 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -8853,7 +8853,6 @@ SYSCALL_DEFINE2(sched_rr_get_interval_time32, pid_t, > pid, > void sched_show_task(struct task_struct *p) > { > unsigned long free = 0; > - int ppid; > > if (!try_get_task_stack(p)) > return; > @@ -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)); > + } 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); > -- > 2.17.1 > > Yuanhan Zhang 于2023年2月16日周四 16:19写道: > > > 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. > > > > Signed-off-by: Tio Zhang > > --- > > kernel/sched/core.c | 18 +++++++++++------- > > 1 file changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index cb2aa2b54c7a..d8fd35684d6c 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -8853,7 +8853,6 @@ SYSCALL_DEFINE2(sched_rr_get_interval_time32, pid_t, > > pid, > > void sched_show_task(struct task_struct *p) > > { > > unsigned long free = 0; > > - int ppid; > > > > if (!try_get_task_stack(p)) > > return; > > @@ -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)); > > + } 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); > > -- > > 2.17.1 > > > > Chen Yu 于2023年2月10日周五 00:22写道: > > > >> On 2023-01-31 at 16:10:26 +0800, 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 better solve the situation when the task > >> s/would better/would be better/ > >> > is not alive and we could not get information about the parent. > >> > > >> > Signed-off-by: Tio Zhang > >> > > >> Looks ok to me, > >> Tested-by: Chen Yu > >> > >> thanks, > >> Chenyu > >> > >