Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp304355ybb; Tue, 31 Mar 2020 23:54:53 -0700 (PDT) X-Google-Smtp-Source: APiQypI80XhU9YiJWJmyjmlw3+orPQpQvRr3h5R57zItuhfhEreaIZNrqGZ65ksTcuMfU3QL49+B X-Received: by 2002:aca:ebc5:: with SMTP id j188mr1837607oih.65.1585724093273; Tue, 31 Mar 2020 23:54:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1585724093; cv=pass; d=google.com; s=arc-20160816; b=C93Q3g0ey3J/OxqZIF8ubby7IcYpwtslI0BlfRoDODpEmHFVz9WJVJqTCfVX4QaAvU PrFUEz91t/yrH1vhnBjZbRK7mvcrpI3MA9jMRc0Bq3DhYfivmOSvKn7JUq1hnKTvy305 wpBZcFNnhKHaTxkPTW0qkZtwNctcg0cpSxJINcjOlrdfPInI3EuUaJ+bm/1LVLU6ljZI STuDV6xmjklyOlQ+jQKjufFoGdmIt9VDuvd/j0/yYAz57HO+AttRKiqmwl6oxHv1GQPM Tt5ZH0xxQ8hVFXNchlyu9cBpAEM4TZE9MoaqKOiO21LDzoqO17bgCbupMQQvVi96VsJC ECow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Zh3zBpkMV/n9dob0IgytRzBV+W2X4eu07FXckX2VrVE=; b=U6WVKV9rb3CMP1OWooLbaBDzP256GJJTQas2Np9VUKzGiftEZNaI9dBM8ZuMoJmuly Fp+faSrbd8OiPbc2eScGY60ZWpUjWDsaA0P51bFC4+hCmRqbzhRxfBIWdbxH6H//TAmL Sz4AVRSaCaXVXC4Sph222+5wtoPVNhd6GYqH2rhGcUXoj9PaSmC2suIK+CZn3q+Gketr lo1wb6xFv22+N3hgusojWV+pH8ymBPjEdpKIB6Na1GenQOGrtekZfXdSqgYUsHZkc9A6 y07wSyw4S57vCVD7CQAWYiZ8oLpKbKTKGTrO+BsybV9xM+MG6is1Z/EgEFKJ0M4bFZdy 6dCw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@live.com header.s=selector1 header.b=X4xcbcgM; arc=pass (i=1 spf=pass spfdomain=live.com dkim=pass dkdomain=live.com dmarc=pass fromdomain=live.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=live.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si471156otk.242.2020.03.31.23.54.39; Tue, 31 Mar 2020 23:54:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@live.com header.s=selector1 header.b=X4xcbcgM; arc=pass (i=1 spf=pass spfdomain=live.com dkim=pass dkdomain=live.com dmarc=pass fromdomain=live.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=live.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731885AbgDAGxI (ORCPT + 99 others); Wed, 1 Apr 2020 02:53:08 -0400 Received: from mail-mw2nam10olkn2065.outbound.protection.outlook.com ([40.92.42.65]:55393 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730426AbgDAGxI (ORCPT ); Wed, 1 Apr 2020 02:53:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLwZGDN42h11ZoI/NLp39HPJpu8Uz8URT0+eSFw5RVZHX/FCy0LbkUneNJN/iL65ZbM/EzhRVUbmtII2NH4Oiyd0HBmk4G9e4HlZpr/uzA28ofOGwMk1kosZQN7+QjQEcwhpKNENdd3lcdjBvKCiuHKSh4gLPzfj4s9t75CZ8ieJZXZv+BnBJmmhVXNDB2i17ErOE1Qu3ljbTdnQYBx6eCe4hTz7P4q3N1JRNXZV5mHKIMme+fFm75oQy+usBvzEquxGz13erlxRisiUbVTNfWvAT/XG8HHRZ2bp/2ee1FigbJU/Fh01A9Posql0Ii1OZ2gqObBHTolBZKA9Uo182g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zh3zBpkMV/n9dob0IgytRzBV+W2X4eu07FXckX2VrVE=; b=mAlXTFlcoCJU44o+0SRUxBlMqpeUCC+Li3gsjWunTdcGd6J6jCkEqE2K7SeYbwjpiMew/+RCtTQG/vcAl4VIVi6EeUnmJ0uVanGv7zR5cyG+I1R8fVdStGAzzm7VGKVAXHHzdBDfyczEe8GV7slVrwWA2InKsHZpa13NYSn69YR+i0vHyZ3kQpF4EgdVj32i7tUKqvR/ZWH/mB0pFz6C+7gB/UJH5K/AxS/X7YEjhiuRngX2pu/I65ttujx4Sbdq8jclZitiQVsOqL2gbF2cSDvHYw5W3owxhTJ9ano1pFAlevy+R2cdPliDJxK712y1DKO56Ev3wEfTjHZBAMHrog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.com; dmarc=pass action=none header.from=live.com; dkim=pass header.d=live.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zh3zBpkMV/n9dob0IgytRzBV+W2X4eu07FXckX2VrVE=; b=X4xcbcgM6R06PivY1fd3D/01RADtnnCgZ+qPgHvQLHuLZCpY7Bq77ylZKofKQxDsN9GnUQW7mBQrlubVKlvpR/g72w5jLrqR14neWBcU+B80FEWzkN7TrB5wSED2lk7+AWVgBozGu3aXKyPdLYdTnJLhMGvxvQfFZ7iru2dFeZDdVYEZgofPIjsv7Mn3LFcOIrFOe9RRfehsj72btO/ZtDbPgB0hZz8E7P1GJxEWB7dgGjNRCcpVifyCngMNap6ZB/gsuqws+Tq253/23bMT02zkVV29FkdMgEjpVUIAeLUHNbAwqtpPkhhXr0OprCoWFyX5PkAQz/C7TXJ8c7gzwA== Received: from DM6NAM10FT030.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::47) by DM6NAM10HT068.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::344) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.17; Wed, 1 Apr 2020 06:53:02 +0000 Received: from DM6PR11MB3531.namprd11.prod.outlook.com (2a01:111:e400:7e86::4c) by DM6NAM10FT030.mail.protection.outlook.com (2a01:111:e400:7e86::224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15 via Frontend Transport; Wed, 1 Apr 2020 06:53:02 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:D4066505403CAB775679B1C29494D8F4FAC8AB048DBCA2485858ADB8927FC8D8;UpperCasedChecksum:D30F6461EB32CA0700430A7E6720455E84BA53986A84799A256448E821CCF462;SizeAsReceived:7534;Count:47 Received: from DM6PR11MB3531.namprd11.prod.outlook.com ([fe80::c844:3598:abc4:cc3c]) by DM6PR11MB3531.namprd11.prod.outlook.com ([fe80::c844:3598:abc4:cc3c%7]) with mapi id 15.20.2856.019; Wed, 1 Apr 2020 06:53:02 +0000 From: liyueyi To: peterz@infradead.org, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, liyueyi Subject: [PATCH] kthread: set kthread state to TASK_IDLE. Date: Wed, 1 Apr 2020 14:52:15 +0800 Message-ID: X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: HKAPR04CA0016.apcprd04.prod.outlook.com (2603:1096:203:d0::26) To DM6PR11MB3531.namprd11.prod.outlook.com (2603:10b6:5:61::21) X-Microsoft-Original-Message-ID: <1585723935-31322-1-git-send-email-liyueyi@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from liyy-linux.mioffice.cn (2408:8607:1b00:a:e654:e8ff:fe9d:faec) by HKAPR04CA0016.apcprd04.prod.outlook.com (2603:1096:203:d0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2856.20 via Frontend Transport; Wed, 1 Apr 2020 06:52:58 +0000 X-Mailer: git-send-email 2.7.4 X-Microsoft-Original-Message-ID: <1585723935-31322-1-git-send-email-liyueyi@live.com> X-TMN: [eaChkloj45/30i8GXw4LQVukpDMV/CdIpq8oKlad0ULKstC10cd+/p8uUDzbwBNQ] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e62b01c5-b03d-4b6b-03f6-08d7d6095257 X-MS-TrafficTypeDiagnostic: DM6NAM10HT068: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rIyk5P64tECo4bXN5gXpApoiCiqRpMhT/oNkLUWhG4w5313Ykf4UYfLGTTGJAVQ+ZtoL0JgQ6dt6/3CnuQiR9asBENJ8c5avNVzDyCHtf1HWBF06Vl15YMPgYp0D5lDGOsUd0Jp1XYIPtnKzCvtMSzMauXzCIahA//sTRGM93DDLRrWqY9QD7AviDD4zpGac X-MS-Exchange-AntiSpam-MessageData: wOdeWQWALWV2KT8nzPV1Xt+nt0UaqE7558TcnmoHZamM8+xV8TUkXXMp9uTMFsLul62Rtpl0LCDttSWIU1Gax+Llkm7+NCIcr5n90mslPFZMxbW+2uEPuhJP0W67oyAbAIi6X64StEdW91NQShdC4CS8f2pwt4cO3VOGDxnBgZoY5klxCDmQ1zrzeOHGCZZJMgvMB5dv0ER2NcA542felA== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: e62b01c5-b03d-4b6b-03f6-08d7d6095257 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 06:53:02.6495 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM10HT068 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: liyueyi Currently kthread() sleeps in TASK_UNINTERRUPTIBLE state waiting for the first wakeup, it may be detected by DETECT_HUNG_TASK if the first wakeup is coming later. Since kernel has introduced TASK_IDLE, change kthread state to TASK_IDLE. Signed-off-by: liyueyi --- kernel/kthread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index b262f470..f841419 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -243,7 +243,7 @@ static int kthread(void *_create) current->vfork_done = &self->exited; /* OK, tell user we're spawned, wait for stop or wakeup */ - __set_current_state(TASK_UNINTERRUPTIBLE); + __set_current_state(TASK_IDLE); create->result = current; complete(done); schedule(); @@ -415,7 +415,7 @@ static void __kthread_bind(struct task_struct *p, unsigned int cpu, long state) void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask) { - __kthread_bind_mask(p, mask, TASK_UNINTERRUPTIBLE); + __kthread_bind_mask(p, mask, TASK_IDLE); } /** @@ -429,7 +429,7 @@ void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask) */ void kthread_bind(struct task_struct *p, unsigned int cpu) { - __kthread_bind(p, cpu, TASK_UNINTERRUPTIBLE); + __kthread_bind(p, cpu, TASK_IDLE); } EXPORT_SYMBOL(kthread_bind); -- 2.7.4