Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933787AbcDEWML (ORCPT ); Tue, 5 Apr 2016 18:12:11 -0400 Received: from mail-by2on0062.outbound.protection.outlook.com ([207.46.100.62]:29856 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933719AbcDEWMG (ORCPT ); Tue, 5 Apr 2016 18:12:06 -0400 Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH 14/25] thread: move thread bits accessors to separated file Date: Wed, 6 Apr 2016 01:08:36 +0300 Message-ID: <1459894127-17698-15-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR03CA0038.eurprd03.prod.outlook.com (25.160.207.48) To BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) X-MS-Office365-Filtering-Correlation-Id: 798f142a-fde6-4db5-9d01-08d35d9f4d4d X-Microsoft-Exchange-Diagnostics: 1;BLUPR07MB612;2:euVdI0EAXtkKpgma2TdKEZ870qCTx7Ta7YKe5H1WbedwaNCpUfGs1ZFNe15tZf8mqRKpnw+xZMOxB+oNAhr1y+YgZ3ngNWno5U3VQQEXfqOO/YNOkeY55zw1/CZlWssbwjFqZjF1SyFvmEPlqcXtve9hvHp+932RYfEuNx3WbxFI2JgDRGfaoelD6zrOHN9A;3:nBZk7Ahn/6WHMuwQ1lidQxv8TpYKonb4R5052q23jecWu6OHAftafPSMSUQwP6Fb3bOIhTft1gU5MnSz3b+iI00Xd2x4IRrE2W5tfO8I4Slym9yGIYF6ikivnvSWbe+P X-Microsoft-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q5ZN07VR/ciS7ZIsAENvfxJY/ucu9gNr/FLl5LZtLl4OYOkP0L1qDhnta0UwZsH36E2Zk98eLDCMgE7u7uqByKY7rUG4jHL9jzdj4u4z5ZljBKfsTFbwPl2tTTc74PD51jhCBIZ+2ljfjLrOKqeahXD1EQvLUb2sbZRX7CihnF7oiPI9eaURfVVPS3xGDc2IMXQeRzAhZtcXIjYLccBrgCAxRgjA4JhZRJ3liDv1kBczIMsHhlEEX0khNHLbjdeWwCkbtmOVR7Kqp7BBFzPDZC0Ak6g1L/uKm6z2mfIlbbSR+y6dc8LI95apjUnrLePJc/KwZkcUb7HW4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:BLUPR07MB612;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1;BLUPR07MB612;4:3zYGC6HxQDg8gBgGLvy1SSGX05iIsWJKippgKKPYX6RZ2PqmV84d3JnCW/Ifd54MUb2Ib7iOKGOi8ujcPUPo82N543IwCTQk8A4STYiEIpNtAdlQP6K3sidZ1/5Lc/06l+D+py82f2DACf1RLJfsVHsseYR4x0jGudPjhOJuGNlNA16v4dsoJ5/JPra0WlNHgBpTW+jkP5j6Ir/WXzuol3wpmQ/AoN20VxPYBy0nHCX9p9ZNutu3SBDRh7wbeeLYCAkw4gXSt5BczJNXIiqLQ/jdJOWXdMr/81ZwA5TaNKbcL1q3KzA3BnI4v+d0DSdK+CNxYTiNo2Xe8SZgjjy5hAdh7vDtQTVbAqxQA70tXtBqZ3IamGJLhT1myZnRPda9 X-Forefront-PRVS: 0903DD1D85 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(33646002)(5008740100001)(3846002)(229853001)(92566002)(19580395003)(77096005)(5004730100002)(1096002)(36756003)(2201001)(50466002)(48376002)(50226001)(47776003)(42186005)(66066001)(4326007)(76506005)(76176999)(6116002)(50986999)(5003940100001)(586003)(81166005)(19580405001)(2950100001)(5001770100001)(189998001)(2906002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR07MB612;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR07MB612;23:DW9+KaR/Z4dDK4fcZ+0Rgyi0qDt2/sm/syGw//q2YiQJBOjbzdKtzWhs/8G8YX5aJ0UmMMWM5zBKkNTEnzj35g2TgozhPJBZnlu0yhCU8bfWkVsIqdnMJOrXUH9qNpna+twWdqrt1SGnZqYz2aY/QNnCp8KKlySe9LMdlR6KdRxLwHZq/7DcwIJrQpP0qagULh9/wYeowR+3XGmg7b2sKD31tj8CjmGXThsUlUmgvWHE6lSKZgJIkQRRdqSHXXqBSCrLZ8djhcSvpQLgyzV+21F21jNm1SlYaedesem1EIeRVgmTXb2VOUKggLI1QUhNMv7G0qDPLDazF6eU9mkSez/DM79kgaC+zj9H7uuXF1RotugE7F3zL4bUT4Ri9q2XBZ6HNTdpY2oIKPKavnkkig+cTywSC4ArKidL2rWSeCXwfQQ2tYGVqmh49gnMHpsqAAZOnZvWl/2venMvcvGB95SbXyskB23irbBEOcUeKEuKFdCwiQ12ObOWwV2lsmXIlLpWaY7e9CDRKR1OdiPyjH4IgHNYY/alrtmXD3hA/GYW0V6pSXIqOwBtxysYGCtxRIYXpyzFsNBgzxITU/kyqJdkXGiW+fzqbS7kKHc8VxV/SoebbLmpnlj0Fx/nz5c0c+fGrw7bSf2fjF9KDgh1dT7uNt2vqRbINDbtWDWE0vqc9jc74hALGj//BmcPjXwhfRNynrHPPcN8Zz09Qxvj73noDmrTlgHghgQUP1iRaszpHpXHZQFMTNRC7yw8BtWymsBtfLYQQ0VrO1vWNFDCQVMcOD4x6Qeg4gDSqCvwzJEusrr9UlSEfddpPSItcaW/F83jzP8I9F8326/XTi8b7HJLiRM21n6bk7ufAi6+qmaOwcXYtVInvZs/DxjmQxTdLdMP1wlD9mvZQId9ALaN7kgcfj9vi2gyvVGnd6Dvq8NWJQwPjUEn97aNbxVK3Mg8 X-Microsoft-Exchange-Diagnostics: 1;BLUPR07MB612;5:nFwiuCcUqulcR017hIKCXkOArkmEc+08qNFDajeul37DDU4zqYksoVtQ4XEA9w3UheycmzByG4SjOeWtsXDWkdbuyyMp96tpZ+eSdAqMxvfjiwnwmy3F13bo6wPbsrS1Ym0mqmP+FCz0spccVtAiFQ==;24:rhUKULz2lIAo5NFQI2HwqxdR2+onOfCbckqjZWxV3HZHH70ICFATt4y+9vUWHhvZ5tMpEOotP1eGUnD+eqs6dhYyMO+RlFvDzipVi5qJv0I= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 22:11:56.4205 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB612 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4261 Lines: 139 They 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 by Al Viro in patch "set_restore_sigmask() is never called without SIGPENDING (and never should be)" [edd63a27] Signed-off-by: Yury Norov --- include/linux/thread_bits.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 44 +----------------------------------- 2 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 include/linux/thread_bits.h diff --git a/include/linux/thread_bits.h b/include/linux/thread_bits.h new file mode 100644 index 0000000..0d05d16 --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,55 @@ + +/* thread_bits.h: common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifndef __ASSEMBLY__ + +#include +#include + +/* + * 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 b4c2a48..b094aed 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -50,8 +50,7 @@ struct restart_block { extern long do_no_restart_syscall(struct restart_block *parm); -#include -#include +#include #ifdef __KERNEL__ @@ -62,47 +61,6 @@ extern long do_no_restart_syscall(struct restart_block *parm); # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_NOTRACK) #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) #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK -- 2.5.0