Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751805AbbD2W1C (ORCPT ); Wed, 29 Apr 2015 18:27:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59275 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbbD2W07 (ORCPT ); Wed, 29 Apr 2015 18:26:59 -0400 Date: Wed, 29 Apr 2015 15:26:58 -0700 From: Andrew Morton To: Chris Metcalf Cc: Frederic Weisbecker , Don Zickus , Ingo Molnar , Andrew Jones , chai wen , Ulrich Obergfell , Fabian Frederick , Aaron Tomlin , Ben Zhang , "Christoph Lameter" , Gilad Ben-Yossef , "Steven Rostedt" , , "Jonathan Corbet" , , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH v9 3/3] procfs: treat parked tasks as sleeping for task state Message-Id: <20150429152658.430cf24064fd0d247d3b8aea@linux-foundation.org> In-Reply-To: <1429295838-6328-3-git-send-email-cmetcalf@ezchip.com> References: <20150416152808.GA16270@lerouge> <1429295838-6328-1-git-send-email-cmetcalf@ezchip.com> <1429295838-6328-3-git-send-email-cmetcalf@ezchip.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2060 Lines: 46 On Fri, 17 Apr 2015 14:37:18 -0400 Chris Metcalf wrote: > Allowing watchdog threads to be parked means that we now have the > opportunity of actually seeing persistent parked threads in the output > of /proc's stat and status files. The existing code reported such "/proc's stat" is ambiguous (/proc/stat?). We can remove all doubt by using full pathnames: /proc//stat. > threads as "Running", which is kind-of true if you think of the case > where we park them as part of taking cpus offline. But if we allow > parking them indefinitely, "Running" is pretty misleading, so we report > them as "Sleeping" instead. > > We could simply report them with a new string, "Parked", but it feels > like it's a bit risky for userspace to see unexpected new values. > The scheduler does report parked tasks with a "P" in debugging output > from sched_show_task() or dump_cpu_task(), but that's a different API. > > This change seemed slightly cleaner than updating the task_state_array > to have additional rows. TASK_DEAD should be subsumed by the exit_state > bits; TASK_WAKEKILL is just a modifier; and TASK_WAKING can very > reasonably be reported as "Running" (as it is now). Only TASK_PARKED > shows up with unreasonable output here. Documentation/filesystems/proc.txt documents /proc//status. It documents "State" explicitly. > --- a/fs/proc/array.c > +++ b/fs/proc/array.c > @@ -126,6 +126,10 @@ static inline const char *get_task_state(struct task_struct *tsk) > { > unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; > > + /* Treat parked tasks as sleeping. */ > + if (tsk->state == TASK_PARKED) > + state = TASK_INTERRUPTIBLE; The comment describes something which is utterly obvious. What it doesn't describe (and should) is *why* we do this. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/