From patchwork Tue Nov 7 21:57:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Arora X-Patchwork-Id: 13449455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52634C4167D for ; Tue, 7 Nov 2023 23:32:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D21344401B2; Tue, 7 Nov 2023 18:32:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD0D344017B; Tue, 7 Nov 2023 18:32:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B23A84401B2; Tue, 7 Nov 2023 18:32:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A2CBE44017B for ; Tue, 7 Nov 2023 18:32:09 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7D698A0B87 for ; Tue, 7 Nov 2023 23:32:09 +0000 (UTC) X-FDA: 81432758778.08.138BCAD Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 2E51612000F for ; Tue, 7 Nov 2023 23:32:05 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=RSF4q7dL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Bjr70j2H; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf29.hostedemail.com: domain of ankur.a.arora@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=ankur.a.arora@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1699399926; a=rsa-sha256; cv=pass; b=aVNGRQsyhgeoeZ36Lbmyw9/cFIz15D00PseOO1h2Ih3+MDLD1ztLpMcJy9ADqTxGzwhGRn kBgukCcIyI1wUztGpuxucHS3ahy+yK2Pf5ISxT2JvTIW5Y56Ob+L91e9rca1kUvgiGegfY i8iIVyzED5YBdNFy0qiSEZPqJY5BxFc= ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=RSF4q7dL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Bjr70j2H; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf29.hostedemail.com: domain of ankur.a.arora@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=ankur.a.arora@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699399926; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=7gwOtmpFNcOX3GHmuR+gkwTDS4oyS5CLF3RfFTaRkeA=; b=hoa3YRRexiORm1XtWliKVjQ4Y/xG2ddFHIJBLfYe1b1BUQqJtkSb2Fj8QFIIwnuOPBdGaA QhGeOV9HWEnn3mCpFmmwTivAuWHyaeu6Yd6VCrHJtuFplnHTObHxVkogqcWjJyCnhC2pb8 +46H7Tu3TLPZxElKTKyaeK7MRvYIXZ8= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LJpqh020714; Tue, 7 Nov 2023 21:59:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=7gwOtmpFNcOX3GHmuR+gkwTDS4oyS5CLF3RfFTaRkeA=; b=RSF4q7dL+sSiBGp8RCV4HseQ1NAaAaisPU4uzW9DgbcrnwclLfxDtSxnKrWEmVSsNYSY JXxJcVDuFqGZfyNYMOIkzXbdzL6Gm50FXvE934n3TM2XAb4IBawQfMZ1kB+8aOlun9mI Y//BAg+6KjwbKSmSYNd+cT3MYezavJkDkPvsY3y2vZCxrxpZWXcX1gpPJ0X+MFuHQUA6 Ix7kA4pOUNZUDVzbeCv3PxOBC3mgYF6qfU3MtdhyyHtTRn7WxYj+oFmuuoqv11wl8d7E sPi31iLpjuJDn1JznRGqtiUhcFPetWucO1XdEtYt/L60OITKVc1uYZ1Bz92mKUz0jM71 /w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u7w2202rx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Nov 2023 21:59:33 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LJ6dH031876; Tue, 7 Nov 2023 21:59:32 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3u7w221gs5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Nov 2023 21:59:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=juPLl9JebQFwr63TdhgZC/oZN4D9KVDbOTgZ0lr7HX2qzxVbfKrXtpewblwfVKayAuE68Xx1uv8SUUZe3kHXAZLy/STF3y4M+xVXuGTmUQ3PQqlzL+jFcgZmmYBRo7jtBowmliSAURGrEoxFotcNdR5GeaCm89XGySz573x8p8wB/iauVf5k0uvC8mH16vSCEjvaSXanEFSH0LVViExtCNnBszy+BTJt1eWzfhdqVgZqX8wP+jwOtzNrpkPte/FlyibKbGC1EPsbwDvvF7BWVPtnQnDLVU/q+Y32H7VqDkJzVkiEF9kwSdwlysmIrkXm9w7uXE2r1ZuJt7CtRLb/Gw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7gwOtmpFNcOX3GHmuR+gkwTDS4oyS5CLF3RfFTaRkeA=; b=CVfL2APtGEiyXYxefjrwDQEEa2LsiLWoWXqz+iHmqAsJPOFMr5oZMgk9pn+EqZ+qUn57yHacGoKDcNY13iO7CknQZWuk1efukEIa9nSlm1HVtIOJ3wnkaFOBVDVngn8ZnVCwwhUp//CUqNRA8cJjs3V+FqRBRFZeslRjchH90bUFkkHNtIxKbJzoVSpiXHIxfLm+OS15/Ep1314fPMxwPPHOiuAufz4fxor2UaNyq6Ny2/If03liXQxpnPSiTKSRuVm5T+SXN0ooWJ0HpLeSv5dMlJ0+l1/qMeitsUnruuwnEMEVhz3VqocmxbOd4pj7VLL/40BGRliYxkp6c+NQ/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7gwOtmpFNcOX3GHmuR+gkwTDS4oyS5CLF3RfFTaRkeA=; b=Bjr70j2H7S6b0tulyA+R4CrKqn+OomFQGtOHXw/W5DjXAvzjrwxtUUDQI1Zir51A/5eZMUIHgr5N/JWXHeazN/b0hvcEGd17gFCSGJyuRa5iNqyV5SnSfH8tjX4vXADVTSkd5Ae38XmInz6n8kwiJGeQrMktNpa4RQAkrpbti+A= Received: from CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) by CY5PR10MB6141.namprd10.prod.outlook.com (2603:10b6:930:37::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Tue, 7 Nov 2023 21:59:29 +0000 Received: from CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::1ce3:4a8c:4c99:acea]) by CO6PR10MB5409.namprd10.prod.outlook.com ([fe80::1ce3:4a8c:4c99:acea%7]) with mapi id 15.20.6954.028; Tue, 7 Nov 2023 21:59:29 +0000 From: Ankur Arora To: linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, paulmck@kernel.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com, mingo@kernel.org, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, rostedt@goodmis.org, David.Laight@ACULAB.COM, richard@nod.at, mjguzik@gmail.com, Ankur Arora Subject: [RFC PATCH 35/86] thread_info: change to tif_need_resched(resched_t) Date: Tue, 7 Nov 2023 13:57:21 -0800 Message-Id: <20231107215742.363031-36-ankur.a.arora@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231107215742.363031-1-ankur.a.arora@oracle.com> References: <20231107215742.363031-1-ankur.a.arora@oracle.com> X-ClientProxiedBy: MW2PR2101CA0010.namprd21.prod.outlook.com (2603:10b6:302:1::23) To CO6PR10MB5409.namprd10.prod.outlook.com (2603:10b6:5:357::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR10MB5409:EE_|CY5PR10MB6141:EE_ X-MS-Office365-Filtering-Correlation-Id: aaa26d15-263c-44ee-ffb6-08dbdfdcd0e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CpR5+w4tAIaxbJzZP2f3z9YDc6zHEh/QBh1RIbJ55kD4SpIIoxYsl6mylXQw72mQEdcm/uN6mkF357MBk8IxWhWfBZGzBg29GmYkSrEHeHhZc1O/wMOLB6LzF+uKtM5iDRoB49zonc/dTGoFjO40dBXJmCcKgPh97mhzGeZTPAia4B2P+YWwjRNSv8Fj21ozhN1iVRMzibblGRATleWn24FsKWfkjSieJmBLSoU/FPrquuH0mQj0FIUZDjthG8XghBQmo0dGbzCHXPMYsM9ndg778HJZBznBcub2NRXWGFETeVoeBf7kcNuWfQ9uR9Crj9nSq7eMoYhK8owmLzsCe792ZOXBaTK7NPZA+f4hGNChm6LUcaPLtnsCTaMJxXsoog7yq5jqWmmGFf+tY+9W5w2E12IezFS06IzCb2ll1XN2qY8Eq7/Kjjxyq30qICkcWXm1KvGgnsyBgpGh5xeLRgnkog34uwQ7fhjYiD49RY7eGlMmjfoB9nq9Y/W/+k5+xSFRzUIcfQG6nqu/ZDXbeZnrVgB87cPvPB2vbFgXWQSG3XfLv0UdkSJL28Z1Y0f8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR10MB5409.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(376002)(39860400002)(136003)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6506007)(86362001)(103116003)(8676002)(478600001)(8936002)(6486002)(4326008)(6666004)(38100700002)(1076003)(5660300002)(36756003)(6512007)(66476007)(6916009)(66946007)(66556008)(316002)(2616005)(7416002)(107886003)(7406005)(2906002)(26005)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bbuCzGxq1q7LjT14re3x1l9lPtuPx1IBOSm9q+1E66HKzGyEzFYmL4XccSVri79eZcFkJTt1tx02WF2Ffw15/oNttp8NFbdM2EcOgNHIPv5eiF+tJ61enhPkkQ0pVxQK6JUxachYkcOOmA4Yzn9SvPWCdxmd+4JEVHBR0KjN1lU8JEuE90IvhP9KzYIrXYj8CmlonlDpXCnez12jibqx+bQNhinewb9WRdgOa1lTJ+2P+K+MtNCjD1CtRDqZ7grVRe0zrgR5PyDrw0hPNGXrSUNiHkDMO5Oq/3KbIfQGSDZXtFHZ7p3tk62Rm7zFReUkCLjOH/edfUD3rzZ0wfx2Nk/xyhWFL8E8knIHKTRtp5H4UhFgmU+/uZI5yAQONIz03J20z6ad2hmA8Qz/O5p9IgNSiwotsGtOeKEZbbUrGvAuDrDarFpbCEr1dEPyiBeUNcIYPCml/xc95UEsF6o4T1TrKbd0CGQ0Rf8r/Qx1Eh/I0g/EMYC0UWfqcDQcbFZt+yF6OYW5GB3TIbpt7fOzpPjovEOjbJhn9YeS+CPgs1woIiDK/A//5IqaQOaTgckn9DUBrWCVTjD/96EsIUsi3dr2cR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KuB2TGcTJk60m0PpWxsiozFissEQJqq+2l+u+IpUpQPmr8jBo67Hic4+6oCBhW2E5PkbiURllN7rVujgpsGkqhRXQ5nWSqnDCPTe7MBdRAKMXhMDdj136soGhW47Jx2vIXiiQWzFMFlFRZ/3ZTb4hGE1utV4IAny0LFzPLodJqSc/b6Xe0LecIs0Wr/gKg1hW7MlzYM9qoKQPD1LV3pK2CdoAX7bfWzpFBuprOBcALp+JzKW8lCZ0ZQBt0d2mpehpJi8ngD1ikPhqlOysmrRqP6edswoo13lMl+u7cIYJFw6V91ksrnM99nKNkhvJMs0GXIiiHi0GBIT11pJllpnyDmcacGYcn3Ss9N6o+QUS57w3bByPUxw0x4ddjh7AFCuMYxEAH2gDvsgfsXbcqISgmrLf0nClqKAT1r+qRX0zYExD1PQ1Us6WawlVeOADolKHE+QP/j6LIr3S3tGv65M08D+sSEw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aaa26d15-263c-44ee-ffb6-08dbdfdcd0e3 X-MS-Exchange-CrossTenant-AuthSource: CO6PR10MB5409.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2023 21:59:29.5043 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PcNgRK19veW389LePbnKODT/nLtKsYMAuAaRxlRKMGaZZJ8EXLM0Svg1nKDa0WmJUfeFvtFedtVp/F2i0Q/qlYxMWuHnjLTXSoF3DtFnJfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6141 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-07_13,2023-11-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311070182 X-Proofpoint-GUID: J0HiGEFMSfRss9c2W97Xe5NHKryfqegn X-Proofpoint-ORIG-GUID: J0HiGEFMSfRss9c2W97Xe5NHKryfqegn X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2E51612000F X-Stat-Signature: og3y7f61in83pw6meew4wo1tirup4aaw X-HE-Tag: 1699399925-618954 X-HE-Meta: U2FsdGVkX1+nzuEMo9McpUkUuULd43Ls3RTYrO+GMZr7+P+JbvKT023pG8DdFZDRYL449fK4DEprwDEFjcvh0q46EAfo6Y2bZMwY4yqgz5C4YfE0CJu/8VgsWR96+rqwDZjSz0Sgw6XkbgbSKW4mHJA/hmJr1oVkvwSVjD6h6tWmqQLyUPG9yPVW1Hf35rrIoiDbmHirX5xarKgx5ns2ZuCIL/PEQ0ke4s1ozxAukLb+7ff0+sRMnV0++RTgSOHPDJd3lOeQNg/OT1ibHeUbRRBOZkrN3/RjYUqDoiFc+rK4W5+ewmavesaKpQqEy+GmZ9xTuQ0Ps0cobPi6YmXCpF+npi4ZsV+ikC61RrzHswnGys/PKmsmpC+ResEniU5UTteV9PFql0+fhQC6QRb97VLwYBoieUuh3tXz5yH4qPveualaJm7bs4B8llt7mLCOHXt1OhEQfJ80qHRPgge1JX/5D7Blk3pm0Z6yDEAX3DawN18CGFd0iTDfgbh9ZviUIW95JW54YjgGl8wBS9orMvyLGIHKe6qIRDkueDkx9MkW8wb3YsR6fMYuMTbRp/t/ss8zdFhV6SPnwJJP8XcBEnnFnskEO6gjTkDHZWLxXpiRgM0YFPmmIfc7AH4ScmWbbNz8f1xy+9v8pSajkPFsayxdcvSZWSWGMaozsRkEKPnSIkNZ6twQhslWbNFPoaLk/U+45gPUquiVxZRvYn2Ejr29mg6CJKkmGnirFxeVVFeHUjhGdpy4s7oDsyD6A4kTlqM0hjLfsp9WbT51HyYwOVYEMoacT78YITinIObO84S69v/VgUVWbF9VtqbrgRwcsdPIwxLzXALNaROzI6H/wuQn3inaNXX1aUgoqA3T1iL3D/Lppq4Hr/LNIpaunBbRZk6ygUbR/tDV5/ZUMovJays8wNQCTn+YyRujEjIe7Z49eSiFqUahB7WEebS8pl0P3mtwIWtGj0/55kTxCC6 MujW7X6Q KIbPA30fQJDirdhAjwc7YYD6txay3FDs0DuFEitxnbtl7mRQXkGgKKNKQewpI88i1Hy7teyJW23hhemPF4qb0yjxugc+cHwIKv/eNlppjUFh5hpXIKVK6w/ATCF1R/rSzIbn06PLMyoCxBR2I2WZHqoKNeUGuBqVGj3Yr0HLaM1VxPm64v81fPJWWERYyYF8+XKz29ElIZAunBt+N+6Shp4Lmq7p4/+upvczkiLWkEC+zhma5HigMjA2hiknbJrOokBy12by4qBThEE/yvd68xPcO1FUH/+SicJbDgFffatZOJvn9p8J8abXtFdMmlDCDWPC+a9q37Wo4y4hzqbj/iO/G9udme/iUMgKABXw3iG3I1mL/aa3t+Hna31peVJ2opBrM9jfUMlwznWzxuR4qNFxVRqP/aNuqzPPO5KWZ/wffHLF1pO+RRVKV7VLxqx4PFOhX40WLUPoSftg8YGtTiJ0oKA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: tif_need_resched() now takes a parameter specifying the resched type: RESCHED_lazy for when we allow the running task to run to completion before eventually scheduling at a userspace boundary and, RESCHED_eager for the next safe preemption point. need_resched(), which is used by non-core code now checks for presence of either of the need-resched bits. Also given that need_resched() (and tif_need_resched() to a lesser extent), is used extensively in the kernel so it is worth noting the common uses and how they will change: - idle: we always want to schedule out of idle whenever there is any work. So the appropriate check is for both the conditions. (Currently we use need_resched() most places and the interfaces defined in sched/idle.h use tif_need_resched().) However, as discussed in later commits it is critical that when scheduling out of idle, we always reschedule with RESCHED_eager (which maps to TIF_NEED_RESCHED.) This suggests that idle code everywhere should instead just do: while (!tif_need_resched(RESCHED_eager) { ... } or similar. That is true, but we have a lot of idle code and it does not seem to make sense to expose scheduler implementation details all over. - uses in conjunction with preempt_count(): we only ever want to fold or make preemption decisions based on TIF_NEED_RESCHED, not TIF_NEED_RESCHED_LAZY. So, related logic needs to use tif_need_resched(RESCHED_eager). - code that relinquishes resources temporarily (locks, irq, etc) checks for should_resched() and would preempt if TIF_NEED_RESCHED were set due to the (preempt_count() == offset) check. The hand-rolled versions, typically check for need_resched() which is a wider check. In either case the final arbiter is preempt_schedule() which checks via preemptible() does the more narrow check. Would it make sense to schedule out for both the need-resched flags? Originally-by: Thomas Gleixner Signed-off-by: Ankur Arora --- arch/s390/include/asm/preempt.h | 4 ++-- drivers/acpi/processor_idle.c | 2 +- include/asm-generic/preempt.h | 4 ++-- include/linux/preempt.h | 2 +- include/linux/sched.h | 4 +++- include/linux/sched/idle.h | 8 ++++---- include/linux/thread_info.h | 8 ++++---- kernel/sched/idle.c | 2 +- kernel/trace/trace.c | 2 +- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/arch/s390/include/asm/preempt.h b/arch/s390/include/asm/preempt.h index bf15da0fedbc..4dddefae1387 100644 --- a/arch/s390/include/asm/preempt.h +++ b/arch/s390/include/asm/preempt.h @@ -114,13 +114,13 @@ static inline void __preempt_count_sub(int val) static inline bool __preempt_count_dec_and_test(void) { - return !--S390_lowcore.preempt_count && tif_need_resched(); + return !--S390_lowcore.preempt_count && tif_need_resched(RESCHED_eager); } static inline bool should_resched(int preempt_offset) { return unlikely(preempt_count() == preempt_offset && - tif_need_resched()); + tif_need_resched(RESCHED_eager)); } #endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */ diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 3a34a8c425fe..1a69f082833e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -108,7 +108,7 @@ static const struct dmi_system_id processor_power_dmi_table[] = { */ static void __cpuidle acpi_safe_halt(void) { - if (!tif_need_resched()) { + if (!need_resched()) { raw_safe_halt(); raw_local_irq_disable(); } diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h index b4d43a4af5f7..4f4abcc5981d 100644 --- a/include/asm-generic/preempt.h +++ b/include/asm-generic/preempt.h @@ -66,7 +66,7 @@ static __always_inline bool __preempt_count_dec_and_test(void) * operations; we cannot use PREEMPT_NEED_RESCHED because it might get * lost. */ - return !--*preempt_count_ptr() && tif_need_resched(); + return !--*preempt_count_ptr() && tif_need_resched(RESCHED_eager); } /* @@ -75,7 +75,7 @@ static __always_inline bool __preempt_count_dec_and_test(void) static __always_inline bool should_resched(int preempt_offset) { return unlikely(preempt_count() == preempt_offset && - tif_need_resched()); + tif_need_resched(RESCHED_eager)); } #ifdef CONFIG_PREEMPTION diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 1424670df161..0abc6a673c41 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -301,7 +301,7 @@ do { \ } while (0) #define preempt_fold_need_resched() \ do { \ - if (tif_need_resched()) \ + if (tif_need_resched(RESCHED_eager)) \ set_preempt_need_resched(); \ } while (0) diff --git a/include/linux/sched.h b/include/linux/sched.h index 95d47783ff6e..5f0d7341cb88 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2172,9 +2172,11 @@ static inline int rwlock_needbreak(rwlock_t *lock) static __always_inline bool need_resched(void) { - return unlikely(tif_need_resched()); + return unlikely(tif_need_resched(RESCHED_eager) || + tif_need_resched(RESCHED_lazy)); } + /* * Wrappers for p->thread_info->cpu access. No-op on UP. */ diff --git a/include/linux/sched/idle.h b/include/linux/sched/idle.h index 478084f9105e..719416fe8ddc 100644 --- a/include/linux/sched/idle.h +++ b/include/linux/sched/idle.h @@ -63,7 +63,7 @@ static __always_inline bool __must_check current_set_polling_and_test(void) */ smp_mb__after_atomic(); - return unlikely(tif_need_resched()); + return unlikely(need_resched()); } static __always_inline bool __must_check current_clr_polling_and_test(void) @@ -76,7 +76,7 @@ static __always_inline bool __must_check current_clr_polling_and_test(void) */ smp_mb__after_atomic(); - return unlikely(tif_need_resched()); + return unlikely(need_resched()); } #else @@ -85,11 +85,11 @@ static inline void __current_clr_polling(void) { } static inline bool __must_check current_set_polling_and_test(void) { - return unlikely(tif_need_resched()); + return unlikely(need_resched()); } static inline bool __must_check current_clr_polling_and_test(void) { - return unlikely(tif_need_resched()); + return unlikely(need_resched()); } #endif diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 4eb22b13bf64..be5333a2c832 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -200,17 +200,17 @@ static __always_inline unsigned long read_ti_thread_flags(struct thread_info *ti #ifdef _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_ATOMIC_H -static __always_inline bool tif_need_resched(void) +static __always_inline bool tif_need_resched(resched_t r) { - return arch_test_bit(TIF_NEED_RESCHED, + return arch_test_bit(tif_resched(r), (unsigned long *)(¤t_thread_info()->flags)); } #else -static __always_inline bool tif_need_resched(void) +static __always_inline bool tif_need_resched(resched_t r) { - return test_bit(TIF_NEED_RESCHED, + return test_bit(tif_resched(r), (unsigned long *)(¤t_thread_info()->flags)); } diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 5007b25c5bc6..d4a55448e459 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -57,7 +57,7 @@ static noinline int __cpuidle cpu_idle_poll(void) ct_cpuidle_enter(); raw_local_irq_enable(); - while (!tif_need_resched() && + while (!need_resched() && (cpu_idle_force_poll || tick_check_broadcast_expired())) cpu_relax(); raw_local_irq_disable(); diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 7f565f0a00da..7f067ad9cf50 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2720,7 +2720,7 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status) if (softirq_count() >> (SOFTIRQ_SHIFT + 1)) trace_flags |= TRACE_FLAG_BH_OFF; - if (tif_need_resched()) + if (tif_need_resched(RESCHED_eager)) trace_flags |= TRACE_FLAG_NEED_RESCHED; if (test_preempt_need_resched()) trace_flags |= TRACE_FLAG_PREEMPT_RESCHED;