From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756356AbcANRZP (ORCPT ); Thu, 14 Jan 2016 12:25:15 -0500 Received: from mail-bl2on0060.outbound.protection.outlook.com ([65.55.169.60]:43567 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932076AbcANRZJ (ORCPT ); Thu, 14 Jan 2016 12:25:09 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , Subject: [PATCH v6 07/21] thread: move thread bits accessors to separated file Date: Thu, 14 Jan 2016 20:23:04 +0300 Message-ID: <1452792198-10718-8-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> References: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: VI1PR05CA0030.eurprd05.prod.outlook.com (25.162.33.168) To CO2PR07MB620.namprd07.prod.outlook.com (10.141.228.156) X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;2:it+LPpIM/PXQ+EVAa23ALTxvKrE9OerWiPzrSHbsqFe1PTKJ1hWazOPFj3+unHycVICy5LQTSF9kNnxY6Ar7Zx5MGcwFaelMsM53uaYK/yhApMn1FyzHmuFbc8vsXHRorK3EabU43/5txbN0cs2NGw==;3:vVE25+RJLZCvSU+mJB8Yo8qkiwSEUi871RtOtqKnLow+poO6N/o55U9NeR7XfPVOJqGgWMeN3twwqZ0VymhRo2Q7qZIWATPRx8XEHt7Ck/aJN1lEjAgIvBepQnYAD2bJ;25:oC8eDEHwTHTEErmlUrYbhhfqscRLf3DguUOSMDniINDCVP9E8kFLlvu4cI7+7wNPDJWIIMqzHenucjsCoBWjKNyaVf206PwRll2CCmKbU2f4XbeZTXhF9hzUOflsP2crU50V3XJuWEVAsb3q8Co1dvZ2zPulVGDrv8ckGzyTvPvzd2KoWrWQo0eZlDoS5OQoDzp4OIDA1zk+A5ut5Cg64gSJ72NBhHuejxhS3VpstUnK8ayj1kkfmJu1JbIoV2CU X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB620; X-MS-Office365-Filtering-Correlation-Id: 2ebbedfb-6cf7-4350-5fc6-08d31d07a601 X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;20:RW/h+FjuZOD/NR5+yXn1fEaExllbtVp0ZNky7XhIx9i0Du+JvN5ZhGzhP31OpJaZYTmsUHboP9LqWOgwlOXc4VoC85V/2MdEf2y8W+dn1Q2GQFOAELBCoe8lTl2hCiTyicTCjZbT4jifFXAkg0nT8wHqS1pLadYcdQW81yBnAoVXGTPrEWuC+/RFcyvd0PU8blv+ggoLHCFViojLCxqDcwddxlpC3ZA1W2ggUecb3PUKzJSk66luz2Q/eN08Bms2AKqOfVSZB2Bon3BFmBflCtfidzx5n0GsPGZiQdVzt5pnxuYCC1gebhTp5oF5IkOnszIyYvjCy27vZzFNDWx8NjXwu0GdyorHgORfkh1q6dGlbohl+xtlYGGHIGhsfsvhKwHo0+pV3BUWvSRxtMRPpYzXg+dEQAjb/HdC1J9S0ZpDylAm76Pp2tdXlrqlp5I6yFqVXwLfBo0H3n8PQJqF9iDGt+C4yfuba/rQFFLAg8KTUBWMd6u3eJjLKa7wkyh/QWmhCp9LzkbbhV1ATkBnEZJLfjGMx5GJan9/MIjd50qJDb6q6bsRMxta7fk+6gKVih3wngbFACmWXeBgHLLVFQb6T1lRtcV877emT32L5DI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046);SRVR:CO2PR07MB620;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB620; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;4:kF9BzZcGnIQzNioL34o6NoNuqdFUQ+ubCRiFma1Cue9WSVIlK7uMIoIHyJ6ojT3krCVoyC81FIiEvpr60kFWp4ahhjDXjEj4VaJKruCALld4EdclGhEJDUHeOLJeUtlp/JhOFRSwLi8V6fgIfCKGgKO0Or8tRTWLDiDjN11ptZtKh8lmceQU85+DCNc8l+zJaywvGNehbON2lhn6fkLkqbPtvctFhIvIAweSg4/QTXqpUqrxNonO+UKeT5xf367VUvsCQsmMtTNL+prg3iNnT3xvAaGJPCtfxujsKdyYnhSMgy3I8hvU3gBiT0Mk7hoDJJ04BbzfsnoDhJTXTlx5OOkr8XhGOCmWdog+taEaa7An8cyvKGcZUTPSJ5R3yVMoaI7EACBbkHdG7hGBWQG01LBB2qIvk0NyWmOlLWj4GQE= X-Forefront-PRVS: 08213D42D3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(189002)(199003)(105586002)(4326007)(122386002)(42186005)(92566002)(50986999)(5003940100001)(40100003)(106356001)(48376002)(19580405001)(19580395003)(66066001)(5008740100001)(101416001)(50466002)(5001960100002)(47776003)(5001770100001)(229853001)(189998001)(81156007)(76176999)(586003)(2201001)(77096005)(6116002)(97736004)(3846002)(5004730100002)(36756003)(1096002)(87976001)(76506005)(2950100001)(2906002)(50226001)(33646002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB620;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR07MB620;23:bcxnR9ogxfhLb/QHR0BcSpy+I0sgRTygvzTC8aGg1l?= =?us-ascii?Q?t/WHFZu5yGPJuP+0vWhknqnRHQwYdOipX62dfbymZGNC5t0N8+pA5i0dI3c5?= =?us-ascii?Q?ifL81uINqxTWxtNgpDPa1uxkot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?rsTm2Tf7TjD9lyeJ1Ub+mzQ1YaOrl5VZ7JLq4r93rw5+ir1CLSEBRbz04mkl?= =?us-ascii?Q?S0wzG0SGZuZFzLmznWhLC5MalB8ntHANAi2e4D7hUnYjhJ+qd+Setqq4TPat?= =?us-ascii?Q?+8zSdNCcw=3D?= X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB620;5:RZV4Q3N7AjZsRnJL2OqycCEvIBXTSiDKSkoYstB1ZuILE/whIIp/lmEMi++K1tGV7VOis19L/deCzpvqCWebU9+gwg4h432y0sEboUQL146Nss+yh6KCCj4GwkCTfw2uVRZZrR8UtBiGiSImi/b3hQ==;24:/A/K/YF8JvImBD8fWd6Mk7pxaZzpbf+HuhqXsFsERqqqaalb8WPKA10WNAM7RTW6vsEKdB6v/oRdyft5DeI8GucjrM2qbVXLm1xLC8ueWM0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2016 17:25:07.1925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB620 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ff307b5..c905fec 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__ @@ -61,47 +60,6 @@ extern long do_no_restart_syscall(struct restart_block *parm); # define THREADINFO_GFP (GFP_KERNEL | __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