diff options
| author | Sumit Singh <sumsingh@nvidia.com> | 2014-03-12 14:44:44 +0530 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-09-10 12:07:09 +0200 |
| commit | 7654fa770bf7a3755ce349fbf3552cf026c35af3 (patch) | |
| tree | 3280fbd8540a1b4f8e2d67b1b29f85be24ecf38b | |
| parent | 0dcf1e209cc28379d6f00c67c8a65ee223ece746 (diff) | |
thread_info: enhance power efficiency
Using cpu_relaxed_read_long and defining relaxed
version of some macros, and functions so that it
can be used to improve power efficiency.
bug 1440421
Change-Id: If857ff7110cffadc6f13289a6395d253a8e3e232
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/380859
(cherry picked from commit a66b23c6971403594cc6a82923c8df3b8472de90)
Reviewed-on: http://git-master/r/422251
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
| -rw-r--r-- | include/linux/thread_info.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 4ae6f32c8..c7e3e8ff7 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -2,6 +2,8 @@ * * Copyright (C) 2002 David Howells (dhowells@redhat.com) * - Incorporating suggestions made by Linus Torvalds + * + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. */ #ifndef _LINUX_THREAD_INFO_H @@ -9,6 +11,7 @@ #include <linux/types.h> #include <linux/bug.h> +#include <asm/relaxed.h> struct timespec; struct compat_timespec; @@ -88,6 +91,12 @@ 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_relaxed(struct thread_info *ti, int flag) +{ + ti->flags = cpu_relaxed_read_long(&ti->flags); + return test_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); @@ -103,12 +112,16 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int 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 test_thread_flag_relaxed(flag) \ + test_ti_thread_flag_relaxed(current_thread_info(), flag) #define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) #define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) +#define tif_need_resched_relaxed() test_thread_flag_relaxed(TIF_NEED_RESCHED) + #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK /* * An arch can define its own version of set_restore_sigmask() to get the |
