Re: [PATCH 2/3] sched/preempt: include asm/current.h

From: Mark Rutland
Date: Thu Oct 13 2016 - 19:26:14 EST


Hi,

On Thu, Oct 13, 2016 at 01:57:11PM +0200, Heiko Carstens wrote:
> The generic preempt code needs to include <asm/current.h>. Otherwise
> compilation fails if THREAD_INFO_IN_TASK is selected and the generic
> preempt code is used:
>
> ./include/linux/thread_info.h:17:54: error: 'current' undeclared (first use in this function)
> #define current_thread_info() ((struct thread_info *)current)

I don't think this is the right fix. Users of current_thread_info() should only
have to include <linux/thread_info.h>, as <asm-generic/preempt.h> already does.

I have a patch [1] which has <linux/thread_info.h> include <asm/current.h> the
THREAD_INFO_IN_TASK case (while avoiding circular includes over <asm/current.h>
and <asm/thread_info.h> in the !THREAD_INFO_IN_TASK case).

I was planning on posting an updated series with that come -rc1.

Thanks,
Mark.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-September/457243.html

>
> Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> ---
> include/asm-generic/preempt.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
> index c1cde3577551..66fcd6cd7fc6 100644
> --- a/include/asm-generic/preempt.h
> +++ b/include/asm-generic/preempt.h
> @@ -2,6 +2,7 @@
> #define __ASM_PREEMPT_H
>
> #include <linux/thread_info.h>
> +#include <asm/current.h>
>
> #define PREEMPT_ENABLED (0)
>
> --
> 2.8.4
>