Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753962AbdHWMZz (ORCPT ); Wed, 23 Aug 2017 08:25:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46696 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbdHWMZy (ORCPT ); Wed, 23 Aug 2017 08:25:54 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2B7206044E Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kimran@codeaurora.org Subject: Re: [PATCH] RFC: hung task: Check specific tasks for long uninterruptible sleep state To: Peter Zijlstra Cc: mingo@kernel.org, imrank140517@gmail.com, "Luis R. Rodriguez" , Kees Cook , Shile Zhang , Matt Fleming , Andrew Morton , Vegard Nossum , Tetsuo Handa , John Siddle , open list , "open list:PROC SYSCTL" References: <1503311156-16919-1-git-send-email-kimran@codeaurora.org> <20170822203632.GQ32112@worktop.programming.kicks-ass.net> From: Imran Khan Message-ID: Date: Wed, 23 Aug 2017 17:55:46 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170822203632.GQ32112@worktop.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2583 Lines: 49 On 8/23/2017 2:06 AM, Peter Zijlstra wrote: > On Mon, Aug 21, 2017 at 03:55:53PM +0530, Imran Khan wrote: >> khungtask by default monitors either all tasks or no tasks at all >> for long unterruptible sleeps. >> For Android like environments this arrangement is not optimal because >> on one hand it may be permissible to have some background(bg) task >> in uninterruptible sleep state for long duration while on the other >> hand it may not be permissible to have some foreground(fg) task like >> surfaceflinger in uninterruptible sleep state for long duration. > > How are you getting tasks in UNINTERRUPTIBLE state for a long time to > begin with? That's not a good thing, background or not. > As of now, I don't have the details of exact test case as most of these issues are coming in android aging and stress tests but I see even in a non-android setup I get few tasks in uninterruptible sleep state for long duration (60 secs). For example, I see there is a thread waiting for mmc requests to appear from block layer. Of course this can be a faulty design on the driver side too but my main intention here is to know if we can enable/disable this monitoring for specific tasks and whether such an option would be useful and agreeable to community or not. Also in current scheme of things we use same timeout for all tasks which may not be optimal. For example if some task is in disk sleep state it may be okay for it to wait for 2 minutes but if surfaceflinger (android) is stuck even for 1 minute, it results in a very poor UI experience for user of the phone. >> So it would be good to have some arrangement so that few specified tasks >> can be monitored by khungtaskd, on a need basis. >> This change introduces a sysctl option, /proc/sys/kernel/ >> hung_task_check_selected, to enable monitoring of selected tasks using >> khungtask daemon. If this sysctl option is enabled then only the tasks >> specified in /proc/hung_task_monitor_list are monitored otherwise all >> tasks are monitored, just like the default case. > > That's horrible. Why not a file in /proc/$PID/ that excludes it from > things? > To be honest, I also had apprehension about my approach and did not think it through. I agree that /proc/$PID/ based approach is much better. If it is agreed that selective monitoring of hung tasks has valid use case(s), I can send the /proc/$PID based patch for review. Thanks for your time and feedback. Regards, Imran -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a\nmember of the Code Aurora Forum, hosted by The Linux Foundation