Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935637AbcJUUts (ORCPT ); Fri, 21 Oct 2016 16:49:48 -0400 Received: from mail-by2nam01on0084.outbound.protection.outlook.com ([104.47.34.84]:64337 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932821AbcJUUtd (ORCPT ); Fri, 21 Oct 2016 16:49:33 -0400 X-Greylist: delayed 888 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Oct 2016 16:49:32 EDT Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH 06/18] thread: move thread bits accessors to separated file Date: Fri, 21 Oct 2016 23:33:05 +0300 Message-ID: <1477081997-4770-7-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> References: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AMSPR04CA0038.eurprd04.prod.outlook.com (10.242.87.156) To DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) X-MS-Office365-Filtering-Correlation-Id: 4f436fd7-2eb0-44c5-85a2-08d3f9f1aa31 X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2249;2:Ho37xMiAdY/Dv3WQPSmqhf2ZpjBRum3CsHnC3xdSOVHULd85V3qrjQGVZ5JK7ttB+6NgNfXy7D3PW+7wJdtkleARcvQ1EPkWLAZMsf/y9SfNX3wvMwHrB3FnLNaoOVjSNRNtwjTUC5td7a+6NsEc5Qd4yKzI4caE6GPgI1W4/tHFoNyWz5MOZriVX5+VwLGXYEd0BZ9cGDn/VrVZtUQRBA==;3:8f3ZuL6FTXmH0lU5aJI+/jgoDGjW6L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S4tr0ZMNHReQxIzTMSyp/ehLGhlSJuayjCO8Gz8DvDR6trGudbAvm8r4LkBOrtwEe8/x1qcLe5okFSkVW3RQPpVxyY7cRZQtMHi1V/UcYaAxhbyFmknpfqE9a9YTyzP1Gahlq3hGhhanBsOSFpxS0IAQGE/FCBZCYwtFvSxpfh39VeEA9vjpB21CPb4JuchCmwniImrX8cr4XsTNbZxuh945XKXtNOsTAm1Koq;20:ulVi9bzMgOeQdpYEVEb/sjnNIqjj7+KCEdr3HIjTrx1o0k9QU+xUwwltGkB6PW4QmyrwhZrkOXhL2NHTXMqf3EjwNGSj150XMnjjDfzq4vf3/rbA+tlDBPX4xr3CsR4NKowVfbGPV/f1KYvxbZWKzskJpK7sGkJM7jKJdkGpvcT5X2NLt+SrJsEIHU5IR0HJQN6zs3tNjd3iYBScQWR81U6qbNVDXQG3gEGCOegwVm6H072JaQUEXn5HwFBkkznnpj+eqx6KassIwQbPJ0v0O7vbA8WYIugZWVkCtpLubsQ4XFaSKUYIzDJPBG8xzADKHYmpZUdRQCkZa+Q7c3dcBRyjAgQQ850/E8qLnWcQx9JnukatoWZHGEgjNsfOTr9012XNAuoQ5fR4o3rkTUiPK7sWIHOIRvrbHj9QGWml4s0DDRpahd3YFIrlGesqnztTbsi3QchkL8YHXJ2qX1qmsAdl/R9fkrVrY7optrwoZ8bIcj9zpvwd8YpWP9ZOpOg5lcFTCx8pHlJ0TkjBhcuu/KYXzr9ehVtlnS9CWeBfo6AWrHekKCY5aPpTHJ+lG7po4yJBuPufMtJH/C5iQzD2NWq6Cv2C0HTiT8WYrXh19EE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:DM3PR07MB2249;BCL:0;PCL:0;RULEID:;SRVR:DM3PR07MB2249; X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2249;4:cRsg817ilEhf4//fEBY62rJG+f7Z4kxqylkQGXWQ698lQpo1niRoqUywkZkxjrPfYaGbwr5lMXGXw2la2fi/3y2YMkTG2V0x54wM+oH9VrbK2uujmCxDDKZGpOgf+EL+snIUNl8OQRCxBkDVWDp65ON2CcvYndXEvX9r2O1A5V8h4G4X9lDPXGJkQq97YV8+WPFc6qciNFJmeNimwfpjtpn4/2+Olkxbzyl8WOetD+kLpa5qs5eaVSE0ximPnH/0QoXqSv/V5GtebGNwW6EjaIDQMtQfA1/AanMq9i9WDDMSjw5oPdmItSIf0qsFCGB1bPCSZCBou0hq9wEiwvysoXGWB1ZGdx3CLYtMA3h+YxDxuO93owcG0+r6sRwJHzr7SRfHsoGIN8MhgB/3z5gdUQ== X-Forefront-PRVS: 01026E1310 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(50466002)(68736007)(5001770100001)(5660300001)(106356001)(101416001)(2906002)(7736002)(48376002)(305945005)(2201001)(4326007)(7846002)(47776003)(6116002)(77096005)(6666003)(2950100002)(19580405001)(19580395003)(36756003)(97736004)(586003)(229853001)(5003940100001)(66066001)(76506005)(7416002)(189998001)(42186005)(3846002)(92566002)(81156014)(105586002)(33646002)(50226002)(8676002)(76176999)(50986999)(81166006)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR07MB2249;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR07MB2249;23:gpnszs4/UlC2gmD9gIeFRz3FPtnTo8gQxiLCaleqo?= =?us-ascii?Q?e8Z6I8XF6UVcd9JOr8yVEK+/kPPvQOUYDIGZPLukrHoc8MCnHDApHtfaUV3h?= =?us-ascii?Q?WYaDgIu3Hw7KoxdDelku6jqh0FXwgMamDM9lh5X5gAESzArjDGLWp4iCmYWo?= =?us-ascii?Q?DRdk3MKGlj9dM1g5OoTFKd7580AnfE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SoCfOQ1GG+R0p2jhXGEd0GIe9XvwYb8XjxNXqP1KpQrfjcRsvl8bUYxYmujMg8CSebvJtMZMg2R+EmPc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2016 20:34:32.3765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2249 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4224 Lines: 138 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 in patch [edd63a27] "set_restore_sigmask() is never called without SIGPENDING (and never should be)" Signed-off-by: Yury Norov --- include/linux/thread_bits.h | 54 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 44 +----------------------------------- 2 files changed, 55 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..ed788b0 --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,54 @@ + +/* 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 45f004e..f6e3239 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -65,8 +65,7 @@ struct restart_block { extern long do_no_restart_syscall(struct restart_block *parm); -#include -#include +#include #ifdef __KERNEL__ @@ -77,47 +76,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) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES -- 2.7.4