diff mbox series

[4/8] sched: powerpc: Remove unused TASK_SIZE_OF

Message ID 20211221170057.2637763-5-guoren@kernel.org (mailing list archive)
State Superseded
Headers show
Series sched: Remove unused TASK_SIZE_OF | expand

Commit Message

Guo Ren Dec. 21, 2021, 5 p.m. UTC
From: Guo Ren <guoren@linux.alibaba.com>

This macro isn't used in Linux sched, now. Delete in
include/linux/sched.h and arch's include/asm.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
---
 arch/powerpc/include/asm/task_size_64.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Christophe Leroy Dec. 21, 2021, 6:43 p.m. UTC | #1
Le 21/12/2021 à 18:00, guoren@kernel.org a écrit :
> From: Guo Ren <guoren@linux.alibaba.com>
> 
> This macro isn't used in Linux sched, now. Delete in
> include/linux/sched.h and arch's include/asm.
> 
> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> ---
>   arch/powerpc/include/asm/task_size_64.h | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
> index c993482237ed..7e2eca4fac4d 100644
> --- a/arch/powerpc/include/asm/task_size_64.h
> +++ b/arch/powerpc/include/asm/task_size_64.h
> @@ -44,12 +44,10 @@
>    */
>   #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
>   
> -#define TASK_SIZE_OF(tsk)						\
> -	(test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :	\
> +#define TASK_SIZE							\
> +	(test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :	\
>   						TASK_SIZE_USER64)

I think you should use test_thread_flag() instead.

Or even better: use is_32bit_task() and bring back this macro as a 
single line, something like:

#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)

>   
> -#define TASK_SIZE TASK_SIZE_OF(current)
> -
>   #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
>   #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
>   
>
Guo Ren Dec. 22, 2021, 3:02 a.m. UTC | #2
On Wed, Dec 22, 2021 at 2:43 AM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 21/12/2021 à 18:00, guoren@kernel.org a écrit :
> > From: Guo Ren <guoren@linux.alibaba.com>
> >
> > This macro isn't used in Linux sched, now. Delete in
> > include/linux/sched.h and arch's include/asm.
> >
> > Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> > ---
> >   arch/powerpc/include/asm/task_size_64.h | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
> > index c993482237ed..7e2eca4fac4d 100644
> > --- a/arch/powerpc/include/asm/task_size_64.h
> > +++ b/arch/powerpc/include/asm/task_size_64.h
> > @@ -44,12 +44,10 @@
> >    */
> >   #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
> >
> > -#define TASK_SIZE_OF(tsk)                                            \
> > -     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
> > +#define TASK_SIZE                                                    \
> > +     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
> >                                               TASK_SIZE_USER64)
>
> I think you should use test_thread_flag() instead.
>
> Or even better: use is_32bit_task() and bring back this macro as a
> single line, something like:
>
> #define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)
Okay, looks better. I would fix it in the next version.

>
> >
> > -#define TASK_SIZE TASK_SIZE_OF(current)
> > -
> >   #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
> >   #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
> >
> >
Christophe Leroy Dec. 22, 2021, 7:27 a.m. UTC | #3
Le 22/12/2021 à 04:02, Guo Ren a écrit :
> On Wed, Dec 22, 2021 at 2:43 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>>
>> Le 21/12/2021 à 18:00, guoren@kernel.org a écrit :
>>> From: Guo Ren <guoren@linux.alibaba.com>
>>>
>>> This macro isn't used in Linux sched, now. Delete in
>>> include/linux/sched.h and arch's include/asm.
>>>
>>> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
>>> ---
>>>    arch/powerpc/include/asm/task_size_64.h | 6 ++----
>>>    1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
>>> index c993482237ed..7e2eca4fac4d 100644
>>> --- a/arch/powerpc/include/asm/task_size_64.h
>>> +++ b/arch/powerpc/include/asm/task_size_64.h
>>> @@ -44,12 +44,10 @@
>>>     */
>>>    #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
>>>
>>> -#define TASK_SIZE_OF(tsk)                                            \
>>> -     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
>>> +#define TASK_SIZE                                                    \
>>> +     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
>>>                                                TASK_SIZE_USER64)
>>
>> I think you should use test_thread_flag() instead.
>>
>> Or even better: use is_32bit_task() and bring back this macro as a
>> single line, something like:
>>
>> #define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)
> Okay, looks better. I would fix it in the next version.

Note that is_32bit_task() exists on powerpc, parisc and sparc.

For other ones you can still use test_thread_flag() instead of 
test_tsk_thread_flag(current)
Guo Ren Dec. 22, 2021, 8:22 a.m. UTC | #4
Got it. Thx

On Wed, Dec 22, 2021 at 3:27 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 22/12/2021 à 04:02, Guo Ren a écrit :
> > On Wed, Dec 22, 2021 at 2:43 AM Christophe Leroy
> > <christophe.leroy@csgroup.eu> wrote:
> >>
> >>
> >>
> >> Le 21/12/2021 à 18:00, guoren@kernel.org a écrit :
> >>> From: Guo Ren <guoren@linux.alibaba.com>
> >>>
> >>> This macro isn't used in Linux sched, now. Delete in
> >>> include/linux/sched.h and arch's include/asm.
> >>>
> >>> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> >>> ---
> >>>    arch/powerpc/include/asm/task_size_64.h | 6 ++----
> >>>    1 file changed, 2 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
> >>> index c993482237ed..7e2eca4fac4d 100644
> >>> --- a/arch/powerpc/include/asm/task_size_64.h
> >>> +++ b/arch/powerpc/include/asm/task_size_64.h
> >>> @@ -44,12 +44,10 @@
> >>>     */
> >>>    #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
> >>>
> >>> -#define TASK_SIZE_OF(tsk)                                            \
> >>> -     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
> >>> +#define TASK_SIZE                                                    \
> >>> +     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
> >>>                                                TASK_SIZE_USER64)
> >>
> >> I think you should use test_thread_flag() instead.
> >>
> >> Or even better: use is_32bit_task() and bring back this macro as a
> >> single line, something like:
> >>
> >> #define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)
> > Okay, looks better. I would fix it in the next version.
>
> Note that is_32bit_task() exists on powerpc, parisc and sparc.
>
> For other ones you can still use test_thread_flag() instead of
> test_tsk_thread_flag(current)
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
index c993482237ed..7e2eca4fac4d 100644
--- a/arch/powerpc/include/asm/task_size_64.h
+++ b/arch/powerpc/include/asm/task_size_64.h
@@ -44,12 +44,10 @@ 
  */
 #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)						\
-	(test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :	\
+#define TASK_SIZE							\
+	(test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :	\
 						TASK_SIZE_USER64)
 
-#define TASK_SIZE TASK_SIZE_OF(current)
-
 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
 #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))