From patchwork Wed May 16 08:18:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 10403025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C30DB601F9 for ; Wed, 16 May 2018 08:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFAB42465D for ; Wed, 16 May 2018 08:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2EF228764; Wed, 16 May 2018 08:26:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1ED402465D for ; Wed, 16 May 2018 08:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VmnPIjE/Nw14tQ6a+yfERoTPQsTSrvGs2rkpbmZf9q0=; b=GfvQ5RYPkQKZPC 0gHHlVfhEOZqf6opt5meNpT4+Qs0ehPJ6rXXliwdlPcMr6UOUxqCs5fFGGgiQZczKkYo8ofDs7kz3 VJLG++u+cJ5lgbr+7JxDaDLGc/4iLrPmwHknN7usdZpvWdXqIPovI9oM4195/t6ZfSjLbFy8FVUEE raiYd+ZfhPs/PI5dl43w0m4f2rH723kMXL6CPEvcWx/F2mm5MtrnwRfMjqLej/jYYfoYEmfhSXd2U 5pvr+k26AOD4Y0L7BUns4C+mro84ONP0Z43GvHoVx83aLalmn1I5feBKtHRDSV9bONxcw9jyPXjLx xkZwJ78wo3jbCLliyZfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrla-0008C1-JV; Wed, 16 May 2018 08:26:34 +0000 Received: from mail-dm3nam03on0617.outbound.protection.outlook.com ([2a01:111:f400:fe49::617] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIrgA-00049C-Vo for linux-arm-kernel@lists.infradead.org; Wed, 16 May 2018 08:21:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oeSBxHIuf/Tqf8yOKE/47XyXXtlLmFlM3t33ksf6H3A=; b=N14R3cslOwjl4jic8Z7FSilI/AjbX7Jno3SDfW5+HU2nSRygbUhVZfB/JNCh0SIIc13csduXPzTMVz1iXQu0/AXsvJiEbkJ+9nzGdIIfuo6oVtN4F1d+cCKqpvYv2I1Vh1uuOnBcKl7Lt44BicYLFIoBWd0ikSVCidgQ5V4wJEU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.36.13) by BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 16 May 2018 08:20:43 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH 06/24] thread: move thread bits accessors to separated file Date: Wed, 16 May 2018 11:18:51 +0300 Message-Id: <20180516081910.10067-7-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516081910.10067-1-ynorov@caviumnetworks.com> References: <20180516081910.10067-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [176.59.36.13] X-ClientProxiedBy: VI1PR08CA0116.eurprd08.prod.outlook.com (2603:10a6:800:d4::18) To BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4376; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4376; 3:MRdyN7uWHM+UfBRjGgFI4bkbFabFzadpv8GMFcGEVJtwmVQZPPO3Entv+ZwtScX5PO4bmgXZkgJZLaZyVpdv0PKQsjOS2hixNaa+9/IOIPLwOcMJbxrVQ7ELRYSmcP64cumppYKhxdawkwZeHBQ2TAla8x9ct0cHgLzLNRwC+VEPmlYTdCyjZwrlEmKOmsyMnZJ3VB5duVVMqI8aH+71P/8xGQvKeP++Sy0pyaig8ghYlX69JrBnjWVOb5mPfMe2; 25:oQMTthZn7PyT2zVbF/+OfGQVjgZMQ+EihQpVXrm9J7kq3COA/AEMgCWCJwlgxxu/hnt3Klhh6Fmpu5HTSapDDpfKwVoITRMr7BzYXnU6wGtauRlSvYikMrsijuQMoVvz76XJrtdIEs7sZr7WjP7sStyD0sTs3ZJ0lMfgpcANTBUkoWWZFe3zjdQ31NV3ZbXCGHgY7wfHLK6DPaTf3PPutJCLFz3QlbtYLMIBXSexNJ4rU0JVc/TlQEa5g71wM8f6bFIe8uOjMUB4y7ketdOX3d8bXBwUr+ilpsB+kX1RjyRsU/yNAiOuXpa5tzhYl2+dt4n94Yb2J5a41Qhgo4QE0A==; 31:x6puukXLwKzVGNaHNCW57M9lBxwagm9LPk1HqYyadzigqCXkjCi4cZ5afaHq3g4grAO1aUCrM7aQcA9UvUvFJ9hp98DJquBJl0Nmo0u1eufNF1BPqIijmMkADzHGdgdI57tPJwLInffazYcizn/9m3PQYAJBTtVVhxsXaas6UIX13HIZ5ZbkYVrHdEQyJGbQji052WvtyYclo44J9naiKBcgF2pxmmfvvfgOm3pp3u4= X-MS-TrafficTypeDiagnostic: BYAPR07MB4376: X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4376; 20:Jyapb+w38GqL5fQQcvZB4AD2u7qH0/pMmjq26AdIyYJVEY/VNRX11bDDYHG0hhWBY4lYNO2weO1qjOURrGtZZwYtin3UxhZ4BEAl9eux9257aN2pAajM8ImYwYHlchKKmSvoMuitW92VTHhv+2HRa7nhgwtZ11tfWWeHNBSXyG9ztaWy6UMU9RJZmXrsPMvvJKrlaYqao9WlkwORKL6D2caew7m/g5XjWUHFSnO+1UfGZYHHEzs5YexTRqgX8s5k/gfDbVpSclBqWB1cmwhmoeXE956w7X3U28JoUzpy+AhhduwwFR35JB5vdlizUnKBsbTEaWCpw6WoCEHJdw/IQC8CedErL1ogf/T08DUkzpBeYxX9ZTUQoGPSipsgLrF13WUqjdbvjCXQCMSj8GRFdEY1A5Nho7esDCFsX30JOxTBj2Fvv0ZU62EqMh7T1PD7c5i14EHs4a4QREEHBXNuH/IJnkFOU8aKgCl1nys8yEzyA7q/GRwMBDpnsUCX0aYn3mJJHrpX/UHjenz2dAddn8aTBzsNxz9NEv9Rx77AJbG9Y5ADWHuuPgt/9q7u8sQ8wJVAi7s3Kz0/Xhs59vPDaqy2UJfu+AjHOAlBC9Sz9PE=; 4:VruydIPwbryDqoZKZKx/capTmkj1DZIbbOaIiPihQ/aaE0pQoAjM8+UjgN1jh7YAypwStnbQVU0++bloYt5WCgqeMkVupTeMTzNlVZV+J1vKwjx4PsZIKSiyKKkiYgzN1QwUowGlMNnK5xbXhTZwB40UGZXaceK6s3jdfI4/oIcpffo+J+RZxlbo6qma28U1cYs8RIz7FHqzP199KEbZjG1qiEQQkJnfxjJgK5ihwisrP+FOr7TGNFrPbIZJtzj46TMYx4qf8UWF6IyTEW+rtw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BYAPR07MB4376; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4376; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(376002)(346002)(366004)(39850400004)(39380400002)(396003)(189003)(199004)(39060400002)(42882007)(59450400001)(6486002)(53936002)(6666003)(4326008)(51416003)(386003)(76176011)(52116002)(446003)(6496006)(50226002)(16586007)(305945005)(7736002)(72206003)(2616005)(26005)(316002)(478600001)(11346002)(36756003)(956004)(105586002)(186003)(16526019)(97736004)(2906002)(486006)(5660300001)(106356001)(8936002)(476003)(76506005)(50466002)(48376002)(110136005)(47776003)(66066001)(25786009)(54906003)(7416002)(3846002)(81166006)(7406005)(1076002)(68736007)(81156014)(8676002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4376; H:localhost; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BYAPR07MB4376; 23:Y+Ae4WdwiUNuLk5kSCCeJLi42tPcYEcxyw+1sxSjP?= =?us-ascii?Q?yIvvjPUTRD3ifZVgk88omwtU2H+dInxjzeisT6/o+ew1Cvlv11aJvnAyeV0E?= =?us-ascii?Q?HzbrpJkgjkODoWg6Okb7yYe18Xnm6LZp+rcxD4OeXHYHRORySbphql0tg0Vp?= =?us-ascii?Q?chC1MWbO7JY2tgs8RTfHnpMbJufx2MQ5Re4psKYKHUN6b0xrtfk1FmJFotZz?= =?us-ascii?Q?P6n9MZSt90YrJVL11EU5z+UNxKZjk3UAu467dJ7ry3ES7G/eBTEJutjS8EjC?= =?us-ascii?Q?rFd1FD+yCGT9eMyIChyR76TyLn34QEkBJbV0lmGcJ5J78ZBWwn8tjzhWySe4?= =?us-ascii?Q?OSAAnz8wy9WVvDkvA3daH8TaRTF1JaVWxPJ0F/lrkv2SksKu7Ztxd9CspgTe?= =?us-ascii?Q?+nb2rmzQH0XEk1c7YumlPXzR0iFI4Z+R14IVRi1MVE7VAQxpR7DFvrPlTeMF?= =?us-ascii?Q?xoi2iyMl0mDFBB39wtTEJwtRbNyQZIBKt8/Bkc/gywWG2pFMx2QHW9KedidS?= =?us-ascii?Q?sxmIfVw4i8ISngm2vGAtPO9bTpGwLIoBBoC7ScAHFxmdMemrOmfBXi+ntfn1?= =?us-ascii?Q?/5UbwgX/PcQvVSJacfRoZ+LqaVEacEneAfsyISjmCOZXcP1+OniQWTAnDSTC?= =?us-ascii?Q?nYRIkM8Fm6sa91JOAasae3U8knE88ZEz6NeMDEtWS3QRxnguujwamfWAWoh0?= =?us-ascii?Q?fEgtX6mX7f0qfesKOsCzftWne+KkcOEVrqY3BCDB9Ih1qDPtAvNosAsiRUK+?= =?us-ascii?Q?XoY9lFQI5an2VmH1HIUKq8O+zQ38zGvVApp8dG57tKENigNbJKKszdN82rJb?= =?us-ascii?Q?6NQeJMPkPqPVa7GAsm6d4He9AZCXD/24uGDhZeJ5VzaPRoS+yjeTUPr+viUl?= =?us-ascii?Q?/mg7PCqVOmtX2BcOW16rw62vQJySUwt/QkgyepEr+2wjsswxgCYVtmPurduZ?= =?us-ascii?Q?y88IA3W/p5BxoKgmZ7D9V4bSgAAYyuIgG/p9o3tMSXdoM0cwWnE/dn9vk5Z9?= =?us-ascii?Q?UmxboOktxzWvI8/tXduGqqfKDgQ7skyvwF7/bfiRWjr77SqJvdBrHe2xZKKe?= =?us-ascii?Q?3/t7N9ch3JTls220/xwk3LEyQ9m6wwNc19VnNNYuYhnv2tBeRpioAzurFUEP?= =?us-ascii?Q?zJdNoe/+XWQsRH9w5JFmj9jVFIGLJq1L5BcqBxJSoWX+k38i39MAAjZtnP6j?= =?us-ascii?Q?38gDLWtwZ1/5+zLYy1nZHRt+ctcarjSr45gvzAsxizx1lsAmd/URTwU7DKSn?= =?us-ascii?Q?OVbeIcmYzhjvmEMEEomNLLf2cIPB11TeTAGtACxcRpq5PmqhScMDVFhou5NI?= =?us-ascii?Q?Avip5QPqr/3ic/Wrpx2prtWgKKtu15HFc8PNS4Sm664eA/POOd2KysRTNIeT?= =?us-ascii?Q?aAL4g=3D=3D?= X-Microsoft-Antispam-Message-Info: Lj7tFqPXMjvk/Xhznz05JLuIxaiVbrri/ar2SyIsZ2zXaJ4PCXYDaWFw8lzsRLlPNY2yjsyMm/eAxE0HQ3felnI6T0Nx8y71RDUe//3DFsSaUtZN7W+2qGhZY40CRk8Qs4ChUuz4Pq2uhcCv0VTDWvGzjwkFPV/AkhyHY2qxLyDq+eK62MavcV5F+rz0qlAl X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4376; 6:PISO3ImZ8UDCM/XOiYCEoK0xSzQ3VA3jHxRATvaAwO77muDdtXxB15PKneKpZ3NFpefF42xGRy8/cRyhXFTU0kzeKTEWAboRSAF1LDZWUtHlS3SV5os4n97DtgoBHVyL+Lsx5a/+NbQRcbQyNHx7PGyVF496r+FdqQ7jwNfYdcH+6XwomkS6DtiL3NgHrcMUDue5wcbw+xh1pbJQ8eQZYP7+EZtjFWMo4esMqKAi3R1Jo+tNWjan0WyQO27hQGvXZXYJb5z3ewE94gQbsRvA2vjWCRhXu+E0TzZ6dTclC0HdchmSqgGniwwwIcj29oWeYI9Z4EkUKNaAChEupHCBh27j/2ssRHLLXU3Pd5+mE59dZcznKJ+gJpbga0DhVnCK/Th18Mgy+qPwxapo/dGUv1Hpxi+idqae4B1trtCBidqaU0eWzamUzLauP4qgNpL95CFnBX0hCkbvekwmIBPqjA==; 5:C1ygaMtIBhrziOKDT0IbPiKB9+0E/gdyAiqf99xa8tcZrvYZ7RHzgusRQcwylyb2LZDRpuPaQfz/Hs7ATMp9E72yF9gPF2I3PPgtZXekwxzUPKnk4/Dj+ZBfDG6JN7FQhVd7QJn2Y9bmKY8j6qLDgw1Uugta3/6dkPwVCcPK7jM=; 24:dbSghtACev4FMqfs/8gsvPj02qBOxLWr+spsUZtyi7AulTbwn+TDQXorH89SNJqcJfGtRHMoeCPHYkD5kMqkx7y6hQiy7vaKLfo14Hea6YM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4376; 7:aNQ4cMrveyW+sm2xFAlkH1qdxRtAAeiRcmU3mdsEOH+VjrSLM6H/UBbfYAdUSOGP2w4EK1Zy27bG9hoS+E3Vnrtu+CkOFIE9Z3AURKaC+85jOyiucP6WztbEIliQB8N9jMXgJeLbNttTaJk2g1YEaEImtbuynILBr5HOBTuSOJBQUnWJ2GNMoG19oYQQxmSuIzhXAtaqU+9MjSFwb6oGz28FvAt2JnV3tKG5E81/7sh1FALBByAadIitgR6d+ROo X-MS-Office365-Filtering-Correlation-Id: a06266f0-582f-414b-5ca8-08d5bb05eb84 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:20:43.5375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a06266f0-582f-414b-5ca8-08d5bb05eb84 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4376 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180516_012059_117226_BA82D792 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Szabolcs Nagy , Heiko Carstens , Yury Norov , Philipp Tomsich , Joseph Myers , Steve Ellcey , Prasun Kapoor , Andreas Schwab , Alexander Graf , Bamvor Zhangjian , Geert Uytterhoeven , Dave Martin , Adam Borowski , Manuel Montezelo , James Hogan , Chris Metcalf , Andrew Pinski , Lin Yongting , Alexey Klimov , Mark Brown , Maxim Kuvyrkov , Florian Weimer , Nathan_Lynch , James Morse , Ramana Radhakrishnan , Martin Schwidefsky , "David S . Miller" , Christoph Muellner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Thread bits may be accessed from low-level code, so isolating is a measure to avoid circular dependencies in header files. The exact reason for circular dependency is WARN_ON() macro added in patch edd63a27 "set_restore_sigmask() is never called without SIGPENDING (and never should be)" Signed-off-by: Yury Norov --- include/linux/sched.h | 1 + include/linux/thread_bits.h | 76 +++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 64 +------------------------------ 3 files changed, 78 insertions(+), 63 deletions(-) create mode 100644 include/linux/thread_bits.h diff --git a/include/linux/sched.h b/include/linux/sched.h index b161ef8a902e..c1bddf06baed 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -27,6 +27,7 @@ #include #include #include +#include /* task_struct member predeclarations (sorted alphabetically): */ struct audit_context; diff --git a/include/linux/thread_bits.h b/include/linux/thread_bits.h new file mode 100644 index 000000000000..7512f8527e9a --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* Common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifndef __ASSEMBLY__ + +/* + * For per-arch arch_within_stack_frames() implementations, defined in + * asm/thread_info.h. + */ +enum { + BAD_STACK = -1, + NOT_STACK = 0, + GOOD_FRAME, + GOOD_STACK, +}; + +#include +#include + +#ifdef CONFIG_THREAD_INFO_IN_TASK +/* + * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the + * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, + * including can cause a circular dependency on some platforms. + */ +#include +#define current_thread_info() ((struct thread_info *)current) +#endif + +/* + * flag set/clear/test wrappers + * - pass TIF_xxxx constants to these functions + */ + +static inline void set_ti_thread_flag(struct thread_info *ti, int flag) +{ + set_bit(flag, (unsigned long *)&ti->flags); +} + +static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) +{ + clear_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_and_set_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_and_clear_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_bit(flag, (unsigned long *)&ti->flags); +} + +#define set_thread_flag(flag) \ + set_ti_thread_flag(current_thread_info(), flag) +#define clear_thread_flag(flag) \ + clear_ti_thread_flag(current_thread_info(), flag) +#define test_and_set_thread_flag(flag) \ + test_and_set_ti_thread_flag(current_thread_info(), flag) +#define test_and_clear_thread_flag(flag) \ + test_and_clear_ti_thread_flag(current_thread_info(), flag) +#define test_thread_flag(flag) \ + test_ti_thread_flag(current_thread_info(), flag) + +#endif /* !__ASSEMBLY__ */ +#endif /* _LINUX_THREAD_BITS_H */ diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 34f053a150a9..793ab9b290ad 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -11,30 +11,9 @@ #include #include #include - -#ifdef CONFIG_THREAD_INFO_IN_TASK -/* - * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the - * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, - * including can cause a circular dependency on some platforms. - */ -#include -#define current_thread_info() ((struct thread_info *)current) -#endif +#include #include - -/* - * For per-arch arch_within_stack_frames() implementations, defined in - * asm/thread_info.h. - */ -enum { - BAD_STACK = -1, - NOT_STACK = 0, - GOOD_FRAME, - GOOD_STACK, -}; - #include #ifdef __KERNEL__ @@ -49,47 +28,6 @@ enum { # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT) #endif -/* - * flag set/clear/test wrappers - * - pass TIF_xxxx constants to these functions - */ - -static inline void set_ti_thread_flag(struct thread_info *ti, int flag) -{ - set_bit(flag, (unsigned long *)&ti->flags); -} - -static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) -{ - clear_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_and_set_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_and_clear_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_bit(flag, (unsigned long *)&ti->flags); -} - -#define set_thread_flag(flag) \ - set_ti_thread_flag(current_thread_info(), flag) -#define clear_thread_flag(flag) \ - clear_ti_thread_flag(current_thread_info(), flag) -#define test_and_set_thread_flag(flag) \ - test_and_set_ti_thread_flag(current_thread_info(), flag) -#define test_and_clear_thread_flag(flag) \ - test_and_clear_ti_thread_flag(current_thread_info(), flag) -#define test_thread_flag(flag) \ - test_ti_thread_flag(current_thread_info(), flag) - #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES