[RHEL7,COMMIT] linux/preempt_mask.h: Add in_task() macro.

Submitted by Konstantin Khorenko on Aug. 31, 2018, 10:23 a.m.

Details

Message ID 201808311023.w7VANiqH004300@finist_ce7.work
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Aug. 31, 2018, 10:23 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.6
------>
commit a4d62e42489ed478e2e4ea2e74eb3ea2f1e72634
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Aug 31 13:23:44 2018 +0300

    linux/preempt_mask.h: Add in_task() macro.
    
    in_task() returns true if we are executing in the task context.
    Implementation has been stolen from upstream.
    
    https://jira.sw.ru/browse/PSBM-87797
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reviewed-by: Denis V. Lunev <den@openvz.org>
---
 include/linux/preempt_mask.h | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
index a492ae8e6f10..5eb3970311dc 100644
--- a/include/linux/preempt_mask.h
+++ b/include/linux/preempt_mask.h
@@ -88,6 +88,8 @@ 
 #define in_softirq()		(softirq_count())
 #define in_interrupt()		(irq_count())
 #define in_serving_softirq()	(softirq_count() & SOFTIRQ_OFFSET)
+#define in_task()		(!(preempt_count() & \
+				   (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)))
 
 /*
  * Are we in NMI context?

Comments

Konstantin Khorenko Aug. 31, 2018, 10:26 a.m.
Please, disregard, rolled back,
will apply next version.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 08/31/2018 01:23 PM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-862.11.6.vz7.71.6
> ------>
> commit a4d62e42489ed478e2e4ea2e74eb3ea2f1e72634
> Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Date:   Fri Aug 31 13:23:44 2018 +0300
>
>     linux/preempt_mask.h: Add in_task() macro.
>
>     in_task() returns true if we are executing in the task context.
>     Implementation has been stolen from upstream.
>
>     https://jira.sw.ru/browse/PSBM-87797
>
>     Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
>     Reviewed-by: Denis V. Lunev <den@openvz.org>
> ---
>  include/linux/preempt_mask.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
> index a492ae8e6f10..5eb3970311dc 100644
> --- a/include/linux/preempt_mask.h
> +++ b/include/linux/preempt_mask.h
> @@ -88,6 +88,8 @@
>  #define in_softirq()		(softirq_count())
>  #define in_interrupt()		(irq_count())
>  #define in_serving_softirq()	(softirq_count() & SOFTIRQ_OFFSET)
> +#define in_task()		(!(preempt_count() & \
> +				   (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)))
>
>  /*
>   * Are we in NMI context?
> .
>